aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2014-02-28 00:07:30 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2014-02-28 00:07:30 +0100
commite23b48847dddb27e7dc7400b994c3fd830b0f48f (patch)
treeb4102d65bcdc8b4c82ef280472e3b054b9ac5c0f /tests
parent420bd3703717623491e710cc63ba57fa1561ab8e (diff)
downloadfactory-boy-e23b48847dddb27e7dc7400b994c3fd830b0f48f.tar
factory-boy-e23b48847dddb27e7dc7400b994c3fd830b0f48f.tar.gz
Add test ensuring that classmethods aren't altered (See #135).
Diffstat (limited to 'tests')
-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):