diff options
author | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2011-09-06 17:18:00 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2011-09-06 17:18:00 +0200 |
commit | 41c68349cf3925818a6c05477790a2f67d431d39 (patch) | |
tree | b3fe0111b500ec97b28f5c5badb9a4709ca9cc7e /factory/test_base.py | |
parent | d17972e3e21c14ecca91e4238fa0726bd1a68a23 (diff) | |
download | factory-boy-41c68349cf3925818a6c05477790a2f67d431d39.tar factory-boy-41c68349cf3925818a6c05477790a2f67d431d39.tar.gz |
Rewrite all the 'OrderedDeclaration' part.
Signed-off-by: Raphaël Barrois <raphael.barrois@polyconseil.fr>
Diffstat (limited to 'factory/test_base.py')
-rw-r--r-- | factory/test_base.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/factory/test_base.py b/factory/test_base.py index 753f116..783e041 100644 --- a/factory/test_base.py +++ b/factory/test_base.py @@ -104,11 +104,7 @@ class FactoryTestCase(unittest.TestCase): class TestObjectFactory(Factory): one = declarations.LazyAttribute(lambda a: a.does_not_exist ) - try: - TestObjectFactory() - self.fail() - except AttributeError as e: - self.assertTrue('does not exist' in str(e)) + self.assertRaises(AttributeError, TestObjectFactory) def testLazyAttributeSequence(self): class TestObjectFactory(Factory): @@ -368,6 +364,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase): FACTORY_FOR = TestObject wrapped = declarations.SubFactory(TestObjectFactory) + friend = declarations.LazyAttribute(lambda o: o.wrapped.two.four + 1) class OuterWrappingTestObjectFactory(Factory): FACTORY_FOR = TestObject @@ -375,9 +372,9 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase): wrap = declarations.SubFactory(WrappingTestObjectFactory, wrapped__two=declarations.SubFactory(TestObjectFactory, four=4)) - outer = OuterWrappingTestObjectFactory.build() self.assertEqual(outer.wrap.wrapped.two.four, 4) + self.assertEqual(outer.wrap.friend, 5) def testStubStrategy(self): Factory.default_strategy = STUB_STRATEGY |