diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2016-04-02 16:11:58 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2016-04-02 16:14:41 +0200 |
commit | eea28cce1544021f3d152782c9932a20402d6240 (patch) | |
tree | 7119e8076be32ce11972c8137fc88ce98698f875 /tests | |
parent | 094a66fb0e6a70c15cc7cbdee5d40ba5e128c433 (diff) | |
download | factory-boy-eea28cce1544021f3d152782c9932a20402d6240.tar factory-boy-eea28cce1544021f3d152782c9932a20402d6240.tar.gz |
Refactor: move error defs to a dedicated module.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_base.py | 11 | ||||
-rw-r--r-- | tests/test_containers.py | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/tests/test_base.py b/tests/test_base.py index dd74e35..a3b3704 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -24,6 +24,7 @@ import warnings from factory import base from factory import declarations +from factory import errors from .compat import unittest @@ -63,7 +64,7 @@ class TestModel(FakeDjangoModel): class SafetyTestCase(unittest.TestCase): def test_base_factory(self): - self.assertRaises(base.FactoryError, base.BaseFactory) + self.assertRaises(errors.FactoryError, base.BaseFactory) class AbstractFactoryTestCase(unittest.TestCase): @@ -88,8 +89,8 @@ class AbstractFactoryTestCase(unittest.TestCase): class TestObjectFactory(base.Factory): pass - self.assertRaises(base.FactoryError, TestObjectFactory.build) - self.assertRaises(base.FactoryError, TestObjectFactory.create) + self.assertRaises(errors.FactoryError, TestObjectFactory.build) + self.assertRaises(errors.FactoryError, TestObjectFactory.create) def test_abstract_factory_not_inherited(self): """abstract=True isn't propagated to child classes.""" @@ -110,8 +111,8 @@ class AbstractFactoryTestCase(unittest.TestCase): abstract = False model = None - self.assertRaises(base.FactoryError, TestObjectFactory.build) - self.assertRaises(base.FactoryError, TestObjectFactory.create) + self.assertRaises(errors.FactoryError, TestObjectFactory.build) + self.assertRaises(errors.FactoryError, TestObjectFactory.create) class OptionsTests(unittest.TestCase): diff --git a/tests/test_containers.py b/tests/test_containers.py index 825e897..20c773a 100644 --- a/tests/test_containers.py +++ b/tests/test_containers.py @@ -23,6 +23,7 @@ from factory import base from factory import containers from factory import declarations +from factory import errors from .compat import unittest @@ -88,7 +89,7 @@ class LazyStubTestCase(unittest.TestCase): stub = containers.LazyStub({'one': LazyAttr('two'), 'two': LazyAttr('one')}) - self.assertRaises(containers.CyclicDefinitionError, getattr, stub, 'one') + self.assertRaises(errors.CyclicDefinitionError, getattr, stub, 'one') def test_representation(self): class RandomObj(object): |