Пример #1
0
    def test_remove_object(self):
        collection = RDFCollection()
        self.assertIsNotNone(collection)

        self.add_data(collection)

        all = collection.all_as_tuples()

        remains = collection.remove(all, obj='2')
        self.assertIsNotNone(remains)
        self.assertEquals(3, len(remains))
        self.assertTrue(["MONKEY", "HASFUR", "true"] in remains)
        self.assertTrue(["ZEBRA", "LEGS", "4"] in remains)
        self.assertTrue(["ELEPHANT", "TRUNK", "true"] in remains)
Пример #2
0
    def test_remove_predicate(self):

        collection = RDFCollection()
        self.assertIsNotNone(collection)

        self.add_data(collection)

        all = collection.all_as_tuples()

        remains = collection.remove(all, predicate='LEGS')
        self.assertIsNotNone(remains)
        self.assertEquals(2, len(remains))
        self.assertTrue(["MONKEY", "HASFUR", "true"] in remains)
        self.assertTrue(["ELEPHANT", "TRUNK", "true"] in remains)
Пример #3
0
    def test_all_as_tuples(self):
        collection = RDFCollection()
        self.assertIsNotNone(collection)

        self.add_data(collection)

        all = collection.all_as_tuples()
        self.assertIsNotNone(all)
        self.assertEquals(5, len(all))
        self.assertTrue(["MONKEY", "LEGS", "2"] in all)
        self.assertTrue(["MONKEY", "HASFUR", "true"] in all)
        self.assertTrue(["ZEBRA", "LEGS", "4"] in all)
        self.assertTrue(["BIRD", "LEGS", "2"] in all)
        self.assertTrue(["ELEPHANT", "TRUNK", "true"] in all)
Пример #4
0
    def test_remove_subject_predicate(self):

        collection = RDFCollection()
        self.assertIsNotNone(collection)

        self.add_data(collection)

        all = collection.all_as_tuples()

        remains = collection.remove(all, subject='MONKEY', predicate="LEGS")
        self.assertIsNotNone(remains)
        self.assertEquals(4, len(remains))
        self.assertTrue(["MONKEY", "HASFUR", "true"] in remains)
        self.assertTrue(["ZEBRA", "LEGS", "4"] in remains)
        self.assertTrue(["BIRD", "LEGS", "2"] in remains)
        self.assertTrue(["ELEPHANT", "TRUNK", "true"] in remains)