Skip to content

Commit a1a0142

Browse files
committed
[test_rdf_reader.py] Add RDF Reader Test For RDF Formats
1 parent 1a0e7f0 commit a1a0142

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/test_rdf_reader.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,25 @@ def setUp(self):
2020
Property(name="prop1", values=[1.3], parent=sec)
2121

2222
self.doc = doc
23+
24+
def test_rdf_formats(self):
25+
"""
26+
Test if document gets correctly converted to odml for turtle, xml and n3.
27+
"""
28+
w = RDFWriter(self.doc).get_rdf_str()
29+
r = RDFReader().from_string(w, "turtle")
30+
self.assertEqual(len(r[0].sections), 1)
31+
self.assertEqual(len(r[0].sections[0].sections), 1)
32+
self.assertEqual(len(r[0].sections[0].properties), 1)
33+
34+
w = RDFWriter(self.doc).get_rdf_str("xml")
35+
r = RDFReader().from_string(w, "xml")
36+
self.assertEqual(len(r[0].sections), 1)
37+
self.assertEqual(len(r[0].sections[0].sections), 1)
38+
self.assertEqual(len(r[0].sections[0].properties), 1)
39+
40+
w = RDFWriter(self.doc).get_rdf_str("n3")
41+
r = RDFReader().from_string(w, "n3")
42+
self.assertEqual(len(r[0].sections), 1)
43+
self.assertEqual(len(r[0].sections[0].sections), 1)
44+
self.assertEqual(len(r[0].sections[0].properties), 1)

0 commit comments

Comments
 (0)