def test_map_relation_collection(self): from atramhasis.renderers import map_relation c = self.collection relation = map_relation(c) self.assertIsInstance(relation, dict) self.assertEqual(relation['id'], 102) self.assertEqual(relation['type'], 'collection') self.assertEqual(relation['uri'], 'urn:x-atramhasis-demo:TREES:102') self.assertIsNone(relation['label']) self.assertRaises(KeyError, lambda: relation['members']) self.assertRaises(KeyError, lambda: relation['member_of'])
def test_map_relation_concept(self): from atramhasis.renderers import map_relation c = self.concept relation = map_relation(c) self.assertIsInstance(relation, dict) self.assertEqual(relation['id'], 101) self.assertEqual(relation['type'], 'concept') self.assertEqual(relation['uri'], 'urn:x-atramhasis-demo:TREES:101') self.assertIsNotNone(relation['label'], 'een label') self.assertRaises(KeyError, lambda: relation['notes']) self.assertRaises(KeyError, lambda: relation['member_of']) self.assertRaises(KeyError, lambda: relation['narrower']) self.assertRaises(KeyError, lambda: relation['broader']) self.assertRaises(KeyError, lambda: relation['related'])