def test_base_type_info_returns_oneof_for_multiple_values(self): prop = Property("foo", "desc") prop.add_type(RefType("ref1")) prop.add_type(RefType("ref2")) self.assertEqual(prop.base_type_info(), { 'oneOf': [ {'$ref': 'ref1'}, {'$ref': 'ref2'}, ] })
def test_base_type_info_returns_type_for_single_value(self): prop = Property("foo", "desc") prop.add_type(RefType("reef")) self.assertEqual(prop.base_type_info(), {'$ref': 'reef'})
def test_base_type_info_defaults_to_string(self): prop = Property("foo", "desc") self.assertEqual(prop.base_type_info(), {'type': 'string'})