summaryrefslogtreecommitdiff
path: root/tests/test_declarations.py
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2013-03-11 22:30:45 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2013-03-11 22:30:45 +0100
commit16e1a65f5b93615d946b74e3fb4d0b61c99ae0d2 (patch)
treee5ca942c8ec37401e96f1fca9a1edde94ec5e1c0 /tests/test_declarations.py
parentde3a552eab032cb980a2fb78976fc3dc8cd5f1c8 (diff)
downloadfactory-boy-16e1a65f5b93615d946b74e3fb4d0b61c99ae0d2.tar
factory-boy-16e1a65f5b93615d946b74e3fb4d0b61c99ae0d2.tar.gz
Remove CircularSubFactory.
Replace CircularSubFactory('module', 'symbol') with SubFactory('module.symbol').
Diffstat (limited to 'tests/test_declarations.py')
-rw-r--r--tests/test_declarations.py44
1 files changed, 0 insertions, 44 deletions
diff --git a/tests/test_declarations.py b/tests/test_declarations.py
index 2e527af..ceadafa 100644
--- a/tests/test_declarations.py
+++ b/tests/test_declarations.py
@@ -363,49 +363,5 @@ class PostGenerationMethodCallTestCase(unittest.TestCase):
-class CircularSubFactoryTestCase(unittest.TestCase):
-
- def test_circularsubfactory_deprecated(self):
- with warnings.catch_warnings(record=True) as w:
- __warningregistry__.clear()
-
- warnings.simplefilter('always')
- declarations.CircularSubFactory('datetime', 'date')
-
- self.assertEqual(1, len(w))
- self.assertIn('CircularSubFactory', str(w[0].message))
- self.assertIn('deprecated', str(w[0].message))
-
- @tools.disable_warnings
- def test_lazyness(self):
- f = declarations.CircularSubFactory('factory.declarations', 'Sequence', x=3)
- self.assertEqual(None, f.factory)
-
- self.assertEqual({'x': 3}, f.defaults)
-
- factory_class = f.get_factory()
- self.assertEqual(declarations.Sequence, factory_class)
-
- @tools.disable_warnings
- def test_cache(self):
- orig_date = datetime.date
- f = declarations.CircularSubFactory('datetime', 'date')
- self.assertEqual(None, f.factory)
-
- factory_class = f.get_factory()
- self.assertEqual(orig_date, factory_class)
-
- try:
- # Modify original value
- datetime.date = None
- # Repeat import
- factory_class = f.get_factory()
- self.assertEqual(orig_date, factory_class)
-
- finally:
- # IMPORTANT: restore attribute.
- datetime.date = orig_date
-
-
if __name__ == '__main__':
unittest.main()