def test_as_dict_includes_expected_fields(self):
     prop = Property("foo", "desc", max_cardinality=3)
     prop.add_enum_value("steve")
     prop.add_enum_value("stove")
     expected_fields = {
         'description': 'desc',
         'oneOf': ['steve', 'stove'],
         'type': 'array',
         'items': {'type': 'string'},
         'maxItems': 3,
     }
     dictified = prop.as_dict()
     for expected_field, expected_value in expected_fields.items():
         self.assertIn(expected_field, dictified)
         self.assertEqual(dictified[expected_field], expected_value)
 def test_add_enum_value_mutex_with_type_constraints(self):
     prop = Property("foo", "desc")
     prop.add_enum_value("steve")
     with self.assertRaises(ValueError):
         prop.add_type(PrimitiveType("string"))
 def test_add_enum_value_adds_enum_value(self):
     prop = Property("foo", "desc")
     prop.add_enum_value("steve")
     self.assertEqual(prop.allowed_values, ["steve"])