예제 #1
0
    def test_a_struct_can_serialize_nested_structs(self):
        another_struct = Struct(baz='blah')
        a_struct = Struct(foo='bar', something=another_struct)

        self.assertEqual(
          {'foo':'bar', 'something': {'baz':'blah'}},
          a_struct.to_struct()
        )
예제 #2
0
    def test_a_struct_can_be_serialized_as_a_dict(self):
        a_struct = Struct(foo='bar')

        self.assertEqual({'foo':'bar'}, a_struct.to_struct())