Example #1
0
 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
Example #2
0
 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
Example #3
0
 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
Example #4
0
 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
Example #5
0
 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')
Example #6
0
 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')
Example #7
0
 def test_get_custom_datatype(self):
     isbn = schema.get_datatype('ISBN')
     self.assertEqual(['DataType'], isbn['ancestors'])
Example #8
0
 def test_get_datatype(self):
     self.assertEqual('Boolean', schema.get_datatype('Boolean')['label'])
Example #9
0
 def test_get_custom_datatype(self):
     isbn = schema.get_datatype('ISBN')
     self.assertEqual(['DataType'], isbn['ancestors'])
Example #10
0
 def test_get_datatype(self):
     self.assertEqual('Boolean', schema.get_datatype('Boolean')['label'])