def test_reconstitute_two_schemas_same_name_same_fields(self):
     """
     Tests that reconsitituting two schemas with the same name and same
     fields results in the same class.
     """
     data = _serialize_type_from_description(
         'same_name_2', [('a', FieldDescriptorProto.TYPE_UINT32)])
     test_class_1 = reconstitute_from_bytes(data)
     test_class_2 = reconstitute_from_bytes(data)
     self.assertEqual(test_class_1, test_class_2)
 def test_reconstitute_two_schemas_different_names_different_fields(self):
     """
     Tests that reconstituting two schemas with different names and
     different fields results in different classes.
     """
     data1 = _serialize_type_from_description(
         'test_6_1', [('a', FieldDescriptorProto.TYPE_UINT32)])
     data2 = _serialize_type_from_description(
         'test_6_2', [('a', FieldDescriptorProto.TYPE_STRING)])
     self.assertNotEqual(data1, data2)
     test_class_1 = reconstitute_from_bytes(data1)
     test_class_2 = reconstitute_from_bytes(data2)
     self.assertNotEqual(test_class_1, test_class_2)
 def test_reconstitute_single_schema(self):
     """
     Tests the reconstitution of a schema with 1 primitive field
     """
     data = _serialize_type_from_description(
         'test_single_schema', [('a', FieldDescriptorProto.TYPE_UINT32)])
     test_class = reconstitute_from_bytes(data)
     test = test_class()
     test.a = 42
     self.assertEqual(42, test.a)
 def test_reconstitute_composite_schema_with_luminance(self):
     """
     Tests the reconstitution of a schema with 1 structure field
     """
     data = _serialize_type_from_description(
         'test_composite_schema',
         [('a', FieldDescriptorProto.TYPE_MESSAGE,
           'bonsai.inkling_types.proto.Luminance')])
     test_class = reconstitute_from_bytes(data)
     test = test_class()
     test.a.width = 42
     self.assertEqual(42, test.a.width)