Ejemplo n.º 1
0
 def test_concept_adapter(self):
     from pyramid_skosprovider.utils import concept_adapter
     c = Concept(
         id=larch['id'],
         labels=larch['labels'],
         notes=larch['notes'],
         concept_scheme=trees.concept_scheme,
         matches=larch['matches']
     )
     concept = concept_adapter(c, {})
     self.assertIsInstance(concept, dict)
     self.assertEqual(concept['id'], 1)
     self.assertIn('uri', concept)
     self.assertIsInstance(concept['label'], text_type)
     self.assertIn(concept['type'], 'concept')
     self.assertEqual(len(concept['labels']), 2)
     self._assert_is_labels(concept['labels'])
     assert 'matches' in concept
     assert 0 == len(concept['matches']['broad'])
     assert 0 == len(concept['matches']['narrow'])
     assert 0 == len(concept['matches']['related'])
     assert 0 == len(concept['matches']['exact'])
     assert 1 == len(concept['matches']['close'])
     assert 'subordinate_arrays' in concept
     assert 0 == len(concept['subordinate_arrays'])
Ejemplo n.º 2
0
 def test_concept_adapter(self):
     from pyramid_skosprovider.utils import concept_adapter
     c = Concept(
         id=larch['id'],
         labels=larch['labels'],
         notes=larch['notes']
     )
     concept = concept_adapter(c, {})
     self.assertIsInstance(concept, dict)
     self.assertEqual(concept['id'], 1)
     self.assertIn('uri', concept)
     self.assertIsInstance(concept['label'], text_type)
     self.assertIn(concept['type'], 'concept')
     self.assertEqual(len(concept['labels']), 2)
     self._assert_is_labels(concept['labels'])