summaryrefslogtreecommitdiff
path: root/tests/test_containers.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_containers.py')
-rw-r--r--tests/test_containers.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_containers.py b/tests/test_containers.py
index 55fe576..797c480 100644
--- a/tests/test_containers.py
+++ b/tests/test_containers.py
@@ -316,6 +316,24 @@ class AttributeBuilderTestCase(unittest.TestCase):
ab = containers.AttributeBuilder(FakeFactory, {'one': 4, 'three': la})
self.assertEqual({'one': 4, 'two': 8, 'three': 8}, ab.build(create=False))
+ def test_subfields(self):
+ class FakeInnerFactory(object):
+ pass
+
+ sf = declarations.SubFactory(FakeInnerFactory)
+
+ class FakeFactory(object):
+ @classmethod
+ def declarations(cls, extra):
+ d = {'one': sf, 'two': 2}
+ d.update(extra)
+ return d
+
+ ab = containers.AttributeBuilder(FakeFactory, {'one__blah': 1, 'two__bar': 2})
+ self.assertTrue(ab.has_subfields(sf))
+ self.assertEqual(['one'], ab._subfields.keys())
+ self.assertEqual(2, ab._attrs['two__bar'])
+
def test_sub_factory(self):
pass