def test_collection_adapter(self): from pyramid_skosprovider.utils import collection_adapter c = Collection( id=species['id'], labels=species['labels'], members=species['members'] ) collection = collection_adapter(c, {}) self.assertIsInstance(collection, dict) self.assertEqual(collection['id'], 3) self.assertIsInstance(collection['label'], text_type) self.assertIn('label', collection) self.assertIn('uri', collection) self.assertEqual(collection['type'], 'collection') self.assertEqual(len(collection['labels']), 2) self._assert_is_labels(collection['labels'])
def test_collection_adapter(self): from pyramid_skosprovider.utils import collection_adapter c = Collection( id=species['id'], labels=species['labels'], members=species['members'], concept_scheme=trees.concept_scheme ) collection = collection_adapter(c, {}) self.assertIsInstance(collection, dict) self.assertEqual(collection['id'], 3) self.assertIsInstance(collection['label'], text_type) self.assertIn('label', collection) self.assertIn('uri', collection) self.assertEqual(collection['type'], 'collection') self.assertEqual(len(collection['labels']), 2) self._assert_is_labels(collection['labels']) self.assertIn('notes', collection) assert not 'matches' in collection assert 'superordinates' in collection assert 0 == len(collection['superordinates'])