summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--factory/containers.py4
-rw-r--r--tests/test_containers.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/factory/containers.py b/factory/containers.py
index e280162..9fe8e46 100644
--- a/factory/containers.py
+++ b/factory/containers.py
@@ -107,13 +107,13 @@ class DeclarationDict(dict):
"""Updates the DeclarationDict from a class definition dict.
Takes into account all public attributes and OrderedDeclaration
- instances; ignores all attributes starting with '_'.
+ instances; ignores all classmethods and attributes starting with '_'.
Returns a dict containing all remaining elements.
"""
remaining = {}
for k, v in d.iteritems():
- if k.startswith('_') and not isinstance(v, declarations.OrderedDeclaration):
+ if isinstance(v, classmethod) or k.startswith('_') and not isinstance(v, declarations.OrderedDeclaration):
remaining[k] = v
else:
self[k] = v
diff --git a/tests/test_containers.py b/tests/test_containers.py
index 34b61d4..b9eaab6 100644
--- a/tests/test_containers.py
+++ b/tests/test_containers.py
@@ -134,7 +134,7 @@ 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, 'four': classmethod(lambda c: 1)})
self.assertEqual(set(['one', 'three']), set(d))
self.assertEqual(set([1, 3]), set(d.values()))