コード例 #1
0
    def test_entity_defaults(self):
        entity = RDFEntity()
        self.assertIsNotNone(entity)
        self.assertIsNone(entity.subject)
        self.assertIsNone(entity.predicate)
        self.assertIsNone(entity.object)

        resultset = RDFQueryResultSet("Subject", "Predicate", "Object", [])
        self.assertEquals("(  )", entity.to_string(resultset))
        self.assertEquals("<subj></subj><pred></pred><obj></obj>",
                          entity.to_xml(None, None))
コード例 #2
0
    def test_entity_variables(self):
        entity = RDFEntity(rdf_subject="Subject",
                           rdf_predicate="Predicate",
                           rdf_object="Object")
        self.assertIsNotNone(entity)
        self.assertIsNotNone(entity.subject)
        self.assertEquals("Subject", entity.subject)
        self.assertIsNotNone(entity.predicate)
        self.assertEquals("Predicate", entity.predicate)
        self.assertIsNotNone(entity.object)
        self.assertEquals("Object", entity.object)

        resultset = RDFQueryResultSet("?x", "?y", "?z", [])
        self.assertEquals("( ?x=Subject, ?y=Predicate, ?z=Object )",
                          entity.to_string(resultset))
        self.assertEquals(
            "<subj>Subject</subj><pred>Predicate</pred><obj>Object</obj>",
            entity.to_xml(None, None))