summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_base.py7
-rw-r--r--tests/test_containers.py9
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_base.py b/tests/test_base.py
index 97749f6..4f77421 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -56,6 +56,13 @@ class SafetyTestCase(unittest.TestCase):
class FactoryTestCase(unittest.TestCase):
+ def testDisplay(self):
+ class TestObjectFactory(base.Factory):
+ FACTORY_FOR = FakeDjangoModel
+
+ self.assertIn('TestObjectFactory', str(TestObjectFactory))
+ self.assertIn('FakeDjangoModel', str(TestObjectFactory))
+
def testLazyAttributeNonExistentParam(self):
class TestObjectFactory(base.Factory):
one = declarations.LazyAttribute(lambda a: a.does_not_exist )
diff --git a/tests/test_containers.py b/tests/test_containers.py
index effb060..6e58573 100644
--- a/tests/test_containers.py
+++ b/tests/test_containers.py
@@ -80,6 +80,15 @@ class LazyStubTestCase(unittest.TestCase):
self.assertRaises(containers.CyclicDefinitionError, getattr, stub, 'one')
+ def test_representation(self):
+ class RandomObj(object):
+ pass
+
+ stub = containers.LazyStub({'one': 1, 'two': 2}, target_class=RandomObj)
+ self.assertIn('RandomObj', repr(stub))
+ self.assertIn('RandomObj', str(stub))
+ self.assertIn('one', str(stub))
+
class OrderedDeclarationMock(declarations.OrderedDeclaration):
pass