summaryrefslogtreecommitdiff
path: root/test/test_turtle_w3c.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_turtle_w3c.py')
-rw-r--r--test/test_turtle_w3c.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/test_turtle_w3c.py b/test/test_turtle_w3c.py
index adeb0868..469ed023 100644
--- a/test/test_turtle_w3c.py
+++ b/test/test_turtle_w3c.py
@@ -10,25 +10,27 @@ from .testutils import nose_tst_earl_report
verbose = False
+
def turtle(test):
g = Graph()
try:
- base = 'http://www.w3.org/2013/TurtleTests/'+split_uri(test.action)[1]
+ base = 'http://www.w3.org/2013/TurtleTests/' + split_uri(test.action)[1]
g.parse(test.action, publicID=base, format='turtle')
if not test.syntax:
raise AssertionError("Input shouldn't have parsed!")
- if test.result: # eval test
+ if test.result: # eval test
res = Graph()
res.parse(test.result, format='nt')
if verbose:
- both, first, second = graph_diff(g,res)
- if not first and not second: return
+ both, first, second = graph_diff(g, res)
+ if not first and not second:
+ return
print("Diff:")
- #print "%d triples in both"%len(both)
+ # print "%d triples in both"%len(both)
print("Turtle Only:")
for t in first:
print(t)
@@ -41,11 +43,11 @@ def turtle(test):
assert isomorphic(g, res), 'graphs must be the same'
-
except:
if test.syntax:
raise
+
testers = {
RDFT.TestTurtlePositiveSyntax: turtle,
RDFT.TestTurtleNegativeSyntax: turtle,
@@ -53,12 +55,14 @@ testers = {
RDFT.TestTurtleNegativeEval: turtle
}
-def test_turtle(tests = None):
+
+def test_turtle(tests=None):
for t in nose_tests(testers,
'test/w3c/turtle/manifest.ttl'):
if tests:
for test in tests:
- if test in t[1].uri: break
+ if test in t[1].uri:
+ break
else:
continue