summaryrefslogtreecommitdiff
path: root/factory
diff options
context:
space:
mode:
Diffstat (limited to 'factory')
-rw-r--r--factory/__init__.py4
-rw-r--r--factory/declarations.py12
2 files changed, 8 insertions, 8 deletions
diff --git a/factory/__init__.py b/factory/__init__.py
index 7f40d6f..cc5b788 100644
--- a/factory/__init__.py
+++ b/factory/__init__.py
@@ -47,12 +47,12 @@ from declarations import (
Sequence,
LazyAttributeSequence,
SelfAttribute,
- LazyContainerAttribute,
+ ContainerAttribute,
SubFactory,
lazy_attribute,
sequence,
lazy_attribute_sequence,
- lazy_container_attribute,
+ container_attribute,
)
diff --git a/factory/declarations.py b/factory/declarations.py
index c28e6af..0ce7071 100644
--- a/factory/declarations.py
+++ b/factory/declarations.py
@@ -108,7 +108,7 @@ class LazyAttributeSequence(Sequence):
return self.function(obj, self.type(sequence))
-class LazyContainerAttribute(OrderedDeclaration):
+class ContainerAttribute(OrderedDeclaration):
"""Variant of LazyAttribute, also receives the containers of the object.
Attributes:
@@ -118,12 +118,12 @@ class LazyContainerAttribute(OrderedDeclaration):
not passed in (i.e used outside a SubFactory).
"""
def __init__(self, function, strict=True, *args, **kwargs):
- super(LazyContainerAttribute, self).__init__(*args, **kwargs)
+ super(ContainerAttribute, self).__init__(*args, **kwargs)
self.function = function
self.strict = strict
def evaluate(self, sequence, obj, containers=()):
- """Evaluate the current LazyContainerAttribute.
+ """Evaluate the current ContainerAttribute.
Args:
obj (LazyStub): a lazy stub of the object being constructed, if
@@ -133,7 +133,7 @@ class LazyContainerAttribute(OrderedDeclaration):
"""
if self.strict and not containers:
raise TypeError(
- "A LazyContainerAttribute in 'strict' mode can only be used "
+ "A ContainerAttribute in 'strict' mode can only be used "
"within a SubFactory.")
return self.function(obj, containers)
@@ -186,5 +186,5 @@ def sequence(func):
def lazy_attribute_sequence(func):
return LazyAttributeSequence(func)
-def lazy_container_attribute(func):
- return LazyContainerAttribute(func, strict=False)
+def container_attribute(func):
+ return ContainerAttribute(func, strict=False)