diff options
-rw-r--r-- | factory/__init__.py | 3 | ||||
-rw-r--r-- | factory/declarations.py | 2 | ||||
-rw-r--r-- | tests/test_using.py | 10 |
3 files changed, 8 insertions, 7 deletions
diff --git a/factory/__init__.py b/factory/__init__.py index 179a633..73425aa 100644 --- a/factory/__init__.py +++ b/factory/__init__.py @@ -60,6 +60,7 @@ from declarations import ( SelfAttribute, ContainerAttribute, SubFactory, + PostGeneration, RelatedFactory, lazy_attribute, @@ -68,6 +69,6 @@ from declarations import ( sequence, lazy_attribute_sequence, container_attribute, - post_declaration, + post_generation, ) diff --git a/factory/declarations.py b/factory/declarations.py index ddc6c78..4d6e767 100644 --- a/factory/declarations.py +++ b/factory/declarations.py @@ -309,7 +309,7 @@ class PostGeneration(PostGenerationDeclaration): self.function(obj, create, extracted, **kwargs) -def post_declaration(extract_prefix=None): +def post_generation(extract_prefix=None): def decorator(fun): return PostGeneration(fun, extract_prefix=extract_prefix) return decorator diff --git a/tests/test_using.py b/tests/test_using.py index 13f23dc..20acd79 100644 --- a/tests/test_using.py +++ b/tests/test_using.py @@ -835,12 +835,12 @@ class IteratorTestCase(unittest.TestCase): self.assertEqual(i % 5, obj.one) -class PostDeclarationHookTestCase(unittest.TestCase): - def test_post_declaration(self): +class PostGenerationDeclarationTestCase(unittest.TestCase): + def test_post_generation(self): class TestObjectFactory(factory.Factory): one = 1 - @factory.post_declaration() + @factory.post_generation() def incr_one(self, _create, _increment): self.one += 1 @@ -852,11 +852,11 @@ class PostDeclarationHookTestCase(unittest.TestCase): self.assertEqual(3, obj.one) self.assertFalse(hasattr(obj, 'incr_one')) - def test_post_declaration_extraction(self): + def test_post_generation_extraction(self): class TestObjectFactory(factory.Factory): one = 1 - @factory.post_declaration() + @factory.post_generation() def incr_one(self, _create, increment=1): self.one += increment |