summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2016-04-02 16:11:58 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2016-04-02 16:14:41 +0200
commiteea28cce1544021f3d152782c9932a20402d6240 (patch)
tree7119e8076be32ce11972c8137fc88ce98698f875 /tests
parent094a66fb0e6a70c15cc7cbdee5d40ba5e128c433 (diff)
downloadfactory-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.py11
-rw-r--r--tests/test_containers.py3
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):