diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_containers.py | 8 | ||||
-rw-r--r-- | tests/test_using.py | 16 |
2 files changed, 23 insertions, 1 deletions
diff --git a/tests/test_containers.py b/tests/test_containers.py index 57c06cf..effb060 100644 --- a/tests/test_containers.py +++ b/tests/test_containers.py @@ -159,7 +159,13 @@ class DeclarationDictTestCase(unittest.TestCase): def test_update_with_public(self): d = containers.DeclarationDict() - d.update_with_public({'one': 1, '_two': 2, 'three': 3}) + d.update_with_public({ + 'one': 1, + '_two': 2, + 'three': 3, + 'classmethod': classmethod(lambda c: 1), + 'staticmethod': staticmethod(lambda: 1), + }) self.assertEqual(set(['one', 'three']), set(d)) self.assertEqual(set([1, 3]), set(d.values())) diff --git a/tests/test_using.py b/tests/test_using.py index e0e59cd..d1e4262 100644 --- a/tests/test_using.py +++ b/tests/test_using.py @@ -280,6 +280,22 @@ class FactoryTestCase(unittest.TestCase): test_object = TestModelFactory.create() self.assertEqual(test_object, "This doesn't even return an instance of TestModel") + def testClassMethodAccessible(self): + class TestObjectFactory(factory.Factory): + @classmethod + def alt_create(cls, **kwargs): + return kwargs + + self.assertEqual(TestObjectFactory.alt_create(foo=1), {"foo": 1}) + + def testStaticMethodAccessible(self): + class TestObjectFactory(factory.Factory): + @staticmethod + def alt_create(**kwargs): + return kwargs + + self.assertEqual(TestObjectFactory.alt_create(foo=1), {"foo": 1}) + class SubFactoryTestCase(unittest.TestCase): def testSubFactory(self): |