diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2012-04-07 02:14:58 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2012-04-07 02:14:58 +0200 |
commit | 4bcf146c71589f4b225823eb418ee6908b2efb6b (patch) | |
tree | 86b997075cf56fa3ac0b9510910c2487995f9a41 /tests | |
parent | 0708fc0bbf29e4426075fcedd45a2d41c6271282 (diff) | |
download | factory-boy-4bcf146c71589f4b225823eb418ee6908b2efb6b.tar factory-boy-4bcf146c71589f4b225823eb418ee6908b2efb6b.tar.gz |
Add and document abstract factories (Closes #8).
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_using.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_using.py b/tests/test_using.py index 7f9f09c..36ecdff 100644 --- a/tests/test_using.py +++ b/tests/test_using.py @@ -211,6 +211,17 @@ class FactoryTestCase(unittest.TestCase): test_object = TestObjectFactory.build() self.assertEqual(test_object.one, 'one') + def test_abstract(self): + class SomeAbstractFactory(factory.Factory): + ABSTRACT_FACTORY = True + one = 'one' + + class InheritedFactory(SomeAbstractFactory): + FACTORY_FOR = TestObject + + test_object = InheritedFactory.build() + self.assertEqual(test_object.one, 'one') + def testSequence(self): class TestObjectFactory(factory.Factory): one = factory.Sequence(lambda n: 'one' + n) |