diff options
Diffstat (limited to 'factory')
-rw-r--r-- | factory/base.py | 2 | ||||
-rw-r--r-- | factory/test_base.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/factory/base.py b/factory/base.py index 733b130..d38c82d 100644 --- a/factory/base.py +++ b/factory/base.py @@ -77,7 +77,7 @@ class BaseFactoryMetaClass(type): # If this isn't a subclass of Factory, don't do anything special. return super(BaseFactoryMetaClass, cls).__new__(cls, class_name, bases, attrs) - declarations = getattr(base, CLASS_ATTRIBUTE_DECLARATIONS, DeclarationsHolder()) + declarations = DeclarationsHolder(defaults=getattr(base, CLASS_ATTRIBUTE_DECLARATIONS, {})) attrs = declarations.update_base(attrs) attrs[CLASS_ATTRIBUTE_DECLARATIONS] = declarations diff --git a/factory/test_base.py b/factory/test_base.py index aa8257b..3909a69 100644 --- a/factory/test_base.py +++ b/factory/test_base.py @@ -176,6 +176,9 @@ class FactoryTestCase(unittest.TestCase): self.assertEqual(test_object.three, 'three') self.assertEqual(test_object.four, 'three four') + test_object_alt = TestObjectFactory.build() + self.assertEqual(None, test_object_alt.three) + def testInheritanceWithInheritedClass(self): class TestObjectFactory(Factory): one = 'one' |