def test_match_subject_object(self): collection = RDFCollection() self.assertIsNotNone(collection) self.add_data(collection) matches = collection.match(subject="MONKEY", object="2") self.assertEquals(1, len(matches)) self.assertEqual("MONKEY", matches[0].subject) self.assertEqual("legs", matches[0].predicate) self.assertEqual("2", matches[0].object)
def test_match_predicate(self): collection = RDFCollection() self.assertIsNotNone(collection) self.add_data(collection) matches = collection.match(predicate="legs") self.assertEquals(3, len(matches)) self.assertEqual("MONKEY", matches[0].subject) self.assertEqual("legs", matches[0].predicate) self.assertEqual("2", matches[0].object) self.assertEqual("ZEBRA", matches[1].subject) self.assertEqual("legs", matches[1].predicate) self.assertEqual("4", matches[1].object) self.assertEqual("BIRD", matches[2].subject) self.assertEqual("legs", matches[2].predicate) self.assertEqual("2", matches[2].object)