def load(self): tokens = self.path.split('/')[1:] if tokens[0] == 'types' and len(tokens) == 1: return {'id': 'types', 'values': schema.get_itemtypes()} elif tokens[0] == 'types': return schema.get_schema(tokens[1]) elif tokens[0] == 'properties': return schema.get_property(tokens[1]) elif tokens[0] == 'datatypes': return schema.get_datatype(tokens[1]) else: return None
def load(self): tokens = self.path.split('/')[1:] if tokens[0] == 'types' and len(tokens) == 1: return {'id': 'types', 'itemtypes': schema.get_itemtypes(), 'selectable_itemtypes': schema.get_selectable_itemtypes()} elif tokens[0] == 'types': return schema.get_schema(tokens[1]) elif tokens[0] == 'sctypes': return schema.get_schema(tokens[1], self_contained=True) elif tokens[0] == 'properties': return schema.get_property(tokens[1]) elif tokens[0] == 'datatypes': return schema.get_datatype(tokens[1]) else: return None
def load(self): tokens = self.path.split("/")[1:] if tokens[0] == "types" and len(tokens) == 1: return { "id": "types", "itemtypes": schema.get_itemtypes(), "selectable_itemtypes": schema.get_selectable_itemtypes(), } elif tokens[0] == "types": return schema.get_schema(tokens[1]) elif tokens[0] == "sctypes": return schema.get_schema(tokens[1], self_contained=True) elif tokens[0] == "properties": return schema.get_property(tokens[1]) elif tokens[0] == "datatypes": return schema.get_datatype(tokens[1]) else: return None
def load(self): tokens = self.path.split('/')[1:] if tokens[0] == 'types' and len(tokens) == 1: return { 'id': 'types', 'itemtypes': schema.get_itemtypes(), 'selectable_itemtypes': schema.get_selectable_itemtypes() } elif tokens[0] == 'types': return schema.get_schema(tokens[1]) elif tokens[0] == 'sctypes': return schema.get_schema(tokens[1], self_contained=True) elif tokens[0] == 'properties': return schema.get_property(tokens[1]) elif tokens[0] == 'datatypes': return schema.get_datatype(tokens[1]) else: return None
def setUp(self): super(SimpleCustomTypeAndPropertyTest, self).setUp() schema.SCHEMA_TO_LOAD.append({ "datatypes": { "ISBN2": { "comment": "ISBN 2", }, }, "properties": { "politicalParty": { "comment": "A political party.", } }, "types": { "Politician": { "supertypes": ["Person"], "specific_properties": ["politicalParty"], "comment": "A political party.", } } }) self.dtype = schema.get_datatype('ISBN2') self.item = schema.get_schema('Politician') self.prop = schema.get_property('politicalParty')
def test_get_custom_datatype(self): isbn = schema.get_datatype('ISBN') self.assertEqual(['DataType'], isbn['ancestors'])
def test_get_datatype(self): self.assertEqual('Boolean', schema.get_datatype('Boolean')['label'])