summaryrefslogtreecommitdiff
path: root/test/test_xmlliterals.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_xmlliterals.py')
-rw-r--r--test/test_xmlliterals.py48
1 files changed, 26 insertions, 22 deletions
diff --git a/test/test_xmlliterals.py b/test/test_xmlliterals.py
index b467e82a..fcc0ddf2 100644
--- a/test/test_xmlliterals.py
+++ b/test/test_xmlliterals.py
@@ -3,24 +3,24 @@ from rdflib import RDF, Graph, Literal
def testPythonRoundtrip():
- l1 = Literal('<msg>hello</msg>', datatype=RDF.XMLLiteral)
- assert l1.value is not None, 'xml must have been parsed'
- assert l1.datatype == RDF.XMLLiteral, 'literal must have right datatype'
+ l1 = Literal("<msg>hello</msg>", datatype=RDF.XMLLiteral)
+ assert l1.value is not None, "xml must have been parsed"
+ assert l1.datatype == RDF.XMLLiteral, "literal must have right datatype"
- l2 = Literal('<msg>good morning</msg>', datatype=RDF.XMLLiteral)
- assert l2.value is not None, 'xml must have been parsed'
- assert not l1.eq(l2), 'literals must NOT be equal'
+ l2 = Literal("<msg>good morning</msg>", datatype=RDF.XMLLiteral)
+ assert l2.value is not None, "xml must have been parsed"
+ assert not l1.eq(l2), "literals must NOT be equal"
l3 = Literal(l1.value)
- assert l1.eq(l3), 'roundtripped literals must be equal'
- assert l3.datatype == RDF.XMLLiteral, 'literal must have right datatype'
+ assert l1.eq(l3), "roundtripped literals must be equal"
+ assert l3.datatype == RDF.XMLLiteral, "literal must have right datatype"
- l4 = Literal('<msg >hello</msg>', datatype=RDF.XMLLiteral)
+ l4 = Literal("<msg >hello</msg>", datatype=RDF.XMLLiteral)
assert l1 == l4
assert l1.eq(l4)
rdflib.NORMALIZE_LITERALS = False
- l4 = Literal('<msg >hello</msg>', datatype=RDF.XMLLiteral)
+ l4 = Literal("<msg >hello</msg>", datatype=RDF.XMLLiteral)
assert l1 != l4
assert l1.eq(l4)
rdflib.NORMALIZE_LITERALS = True
@@ -49,9 +49,13 @@ def testRDFXMLParse():
def graph():
g = rdflib.Graph()
- g.add((rdflib.URIRef('http://example.org/a'),
- rdflib.URIRef('http://example.org/p'),
- rdflib.Literal('<msg>hei</hei>', datatype=RDF.XMLLiteral)))
+ g.add(
+ (
+ rdflib.URIRef("http://example.org/a"),
+ rdflib.URIRef("http://example.org/p"),
+ rdflib.Literal("<msg>hei</hei>", datatype=RDF.XMLLiteral),
+ )
+ )
return g
@@ -65,20 +69,20 @@ def roundtrip(fmt):
def testRoundtrip():
- roundtrip('xml')
- roundtrip('n3')
- roundtrip('nt')
+ roundtrip("xml")
+ roundtrip("n3")
+ roundtrip("nt")
def testHTML():
- l1 = Literal('<msg>hello</msg>', datatype=RDF.XMLLiteral)
- assert l1.value is not None, 'xml must have been parsed'
- assert l1.datatype == RDF.XMLLiteral, 'literal must have right datatype'
+ l1 = Literal("<msg>hello</msg>", datatype=RDF.XMLLiteral)
+ assert l1.value is not None, "xml must have been parsed"
+ assert l1.datatype == RDF.XMLLiteral, "literal must have right datatype"
- l2 = Literal('<msg>hello</msg>', datatype=RDF.HTML)
- assert l2.value is not None, 'xml must have been parsed'
- assert l2.datatype == RDF.HTML, 'literal must have right datatype'
+ l2 = Literal("<msg>hello</msg>", datatype=RDF.HTML)
+ assert l2.value is not None, "xml must have been parsed"
+ assert l2.datatype == RDF.HTML, "literal must have right datatype"
assert l1 != l2
assert not l1.eq(l2)