Example #1
0
 def test_set_cstruct_child_cstructs_is_SequenceItems(self):
     from colander import SequenceItems
     schema = DummySchema()
     schema.cstruct_children = lambda *arg: SequenceItems(['1'])
     field = self._makeOne(schema)
     child = DummyField()
     child.cstruct = 'foo'
     field.children = [child]
     field.cstruct = ['yo']
     self.assertEqual(field.cstruct, ['yo'])
     self.assertEqual(child.cstruct, 'foo')  # unchanged
Example #2
0
    def test_set_cstruct_child_cstructs_is_SequenceItems(self):
        # Pyramid
        from colander import SequenceItems

        schema = DummySchema()
        schema.cstruct_children = lambda *arg: SequenceItems(["1"])
        field = self._makeOne(schema)
        child = DummyField()
        child.cstruct = "foo"
        field.children = [child]
        field.cstruct = ["yo"]
        self.assertEqual(field.cstruct, ["yo"])
        self.assertEqual(child.cstruct, "foo")  # unchanged