class TestNTriplesDocument(TestDocument): def setUp(self): self.doc = Document(TEST['NT-Document'], TESTS['datatypes-intensional/test002.nt']) self.file = open_data_file('rdfcore/datatypes-intensional/test002.nt') self.reader = NTriplesReader() super().setUp() def test_has_type(self): self.assertEqual(self.doc.type, TEST['NT-Document']) def test_has_uri(self): self.assertEqual(self.doc.uri, TESTS['datatypes-intensional/test002.nt']) def test_open_with_unmatched_uri_raises_exception(self): opener = URItoFileOpener({}) self.assertRaises(URLError, self.doc.open, opener) def test_open_opens_referenced_file(self): self.assertEqual(self.doc.open(TEST_OPENER).read(), self.file.read()) def test_read_yields_triples_from_file(self): self.assertSameElements(self.doc.read(TEST_OPENER), self.reader.read(self.file))
class TestRDFXMLDocument(TestDocument): def setUp(self): self.doc = Document(TEST['RDF-XML-Document'], TESTS['datatypes/test001.rdf']) self.file = open_data_file('rdfcore/datatypes/test001.rdf') self.reader = RDFXMLReader() super().setUp() def test_has_type(self): self.assertEqual(self.doc.type, TEST['RDF-XML-Document']) def test_has_uri(self): self.assertEqual(self.doc.uri, TESTS['datatypes/test001.rdf']) def test_open_with_unmatched_uri_raises_exception(self): opener = URItoFileOpener({}) self.assertRaises(URLError, self.doc.open, opener) def test_open_opens_referenced_file(self): self.assertEqual(self.doc.open(TEST_OPENER).read(), self.file.read()) def test_read_yields_triples_from_file(self): self.assertEqual(set(self.doc.read(TEST_OPENER)), set(self.reader.read(self.file)))
class TestPositiveParserTestCase(TestRDFTestCase): test = Test(TEST.PositiveParserTest, EX.test) test.status = 'APPROVED' test.input_documents = { Document(TEST['NT-Document'], TESTS['datatypes/test001.nt']) } test.output_document = Document(TEST['NT-Document'], TESTS['datatypes/test001.nt']) def test_runs_without_errors(self): self.assertEqual(self.result.errors, []) self.assertEqual(self.result.skipped, []) self.assertEqual(self.result.testsRun, 1)
def test_has_output_document(self): self.assertEqual(self.test.output_document, Document(TEST['NT-Document'], TESTS['amp-in-url/test001.nt']))
def test_has_input_documents(self): self.assertEqual(set(self.test.input_documents), {Document(TEST['RDF-XML-Document'], TESTS['amp-in-url/test001.rdf'])})
def test_has_documents(self): self.assertEqual(set(self.test.documents), {Document(TEST['NT-Document'], TESTS['rdfms-uri-substructure/error001.nt'])})
def setUp(self): self.doc = Document(TEST['NT-Document'], TESTS['datatypes-intensional/test002.nt']) self.file = open_data_file('rdfcore/datatypes-intensional/test002.nt') self.reader = NTriplesReader() super().setUp()
def _input_documents(cls, element): for parent in element.findall(str(QName(TEST, 'inputDocument'))): for child in parent: yield Document.from_element(child)
def _output_document(cls, element): for parent in element.findall(str(QName(TEST, 'outputDocument'))): for child in parent: return Document.from_element(child)
def setUp(self): self.doc = Document(TEST['RDF-XML-Document'], TESTS['datatypes/test001.rdf']) self.file = open_data_file('rdfcore/datatypes/test001.rdf') self.reader = RDFXMLReader() super().setUp()
def setUp(self): self.doc = Document(TEST['False-Document']) super().setUp()
def _conclusion_document(cls, element): for parent in element.findall(str(QName(TEST, 'conclusionDocument'))): for child in parent: return Document.from_element(child)
def test_has_input_document(self): self.assertEqual(self.test.input_document, Document(TEST['RDF-XML-Document'], TESTS['rdf-charmod-literals/error001.rdf']))
def test_has_premise_documents(self): self.assertEqual(set(self.test.premise_documents), {Document(TEST['NT-Document'], TESTS['datatypes-intensional/test001.nt'])})
def test_has_conclusion_document(self): self.assertEqual(self.test.conclusion_document, Document(TEST['False-Document']))