aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_base.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_base.py b/tests/test_base.py
index 8cea6fc..ba69164 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -88,6 +88,20 @@ class AbstractFactoryTestCase(unittest.TestCase):
self.assertRaises(base.FactoryError, TestObjectFactory.create)
+class DeclarationParsingTests(unittest.TestCase):
+ def test_classmethod(self):
+ class TestObjectFactory(base.Factory):
+ FACTORY_FOR = TestObject
+
+ @classmethod
+ def some_classmethod(cls):
+ return cls.create()
+
+ self.assertTrue(hasattr(TestObjectFactory, 'some_classmethod'))
+ obj = TestObjectFactory.some_classmethod()
+ self.assertEqual(TestObject, obj.__class__)
+
+
class FactoryTestCase(unittest.TestCase):
def test_factory_for(self):
class TestObjectFactory(base.Factory):