Esempio n. 1
0
 def test_extract_cardinalities_raises_exception_due_to_improper_max_value(self):
     binding = [{
         u'predicate': {u'type': u'uri',
                        u'value': u'http://test/person/gender'},
         u'range': {u'type': u'uri',
                    u'value': u'http://test/person/Gender'},
         u'max': {u'datatype': u'http://www.w3.org/2001/XMLSchema#integer',
                  u'type': u'typed-literal', u'value': u'abc'}
     }]
     with self.assertRaises(schema.InstanceError) as error:
         _extract_cardinalities(binding, {})
         self.assertEqual(error.exception, "InstanceError: The property http://test/person/gender defines a non-integer owl:maxQualifiedCardinality abc")
Esempio n. 2
0
 def test_extract_max_1_show_omit(self):
     binding = [{
         u'predicate': {u'type': u'uri',
                        u'value': u'http://test/person/gender'},
         u'range': {u'type': u'uri',
                    u'value': u'http://test/person/Gender'},
         u'max': {u'datatype': u'http://www.w3.org/2001/XMLSchema#integer',
                  u'type': u'typed-literal', u'value': u'1'}
     }]
     extracted = _extract_cardinalities(binding, {})
     expected = {u'http://test/person/gender': {u'http://test/person/Gender': {'maxItems': 1}}}
     self.assertEqual(extracted, expected)