diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2012-05-04 01:17:59 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2012-05-04 01:17:59 +0200 |
commit | d96c651f51b25988235ff79b50c7f9355fb16dd7 (patch) | |
tree | 02972dccdf0301df2e8781d44de47fd7d3b99598 /tests/test_base.py | |
parent | fbd66ede5617a40f73dfb3f518c9887d48ab401e (diff) | |
download | factory-boy-d96c651f51b25988235ff79b50c7f9355fb16dd7.tar factory-boy-d96c651f51b25988235ff79b50c7f9355fb16dd7.tar.gz |
Only absorb dependant arguments for SubFactory fields (Closes #15).
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'tests/test_base.py')
-rw-r--r-- | tests/test_base.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_base.py b/tests/test_base.py index e0a6547..7575ee2 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -229,5 +229,23 @@ class FactoryCreationTestCase(unittest.TestCase): self.assertTrue('autodiscovery' not in str(e)) +class PostGenerationParsingTestCase(unittest.TestCase): + + def test_extraction(self): + class TestObjectFactory(base.Factory): + foo = declarations.PostGenerationDeclaration() + + self.assertIn('foo', TestObjectFactory._postgen_declarations) + + def test_classlevel_extraction(self): + class TestObjectFactory(base.Factory): + foo = declarations.PostGenerationDeclaration() + foo__bar = 42 + + self.assertIn('foo', TestObjectFactory._postgen_declarations) + self.assertIn('foo__bar', TestObjectFactory._declarations) + + + if __name__ == '__main__': unittest.main() |