From e23b48847dddb27e7dc7400b994c3fd830b0f48f Mon Sep 17 00:00:00 2001 From: Raphaƫl Barrois Date: Fri, 28 Feb 2014 00:07:30 +0100 Subject: Add test ensuring that classmethods aren't altered (See #135). --- tests/test_base.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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): -- cgit v1.2.3