g = Graph() try: g.parse(test.action, format='nt') if not test.syntax: raise AssertionError("Input shouldn't have parsed!") except: if test.syntax: raise testers = { RDFT.TestNTriplesPositiveSyntax: nt, RDFT.TestNTriplesNegativeSyntax: nt } def test_nt(tests=None): for t in nose_tests(testers, 'test/w3c/nt/manifest.ttl', legacy=True): if tests: for test in tests: if test in t[1].uri: break else: continue yield t if __name__ == '__main__': verbose = True nose_tst_earl_report(test_nt, 'rdflib_nt')
except: if test.syntax: raise testers = { RDFT.TestTurtlePositiveSyntax: turtle, RDFT.TestTurtleNegativeSyntax: turtle, RDFT.TestTurtleEval: turtle, RDFT.TestTurtleNegativeEval: turtle } 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 else: continue yield t if __name__ == '__main__': verbose = True nose_tst_earl_report(test_turtle, 'rdflib_turtle')
except: if test.syntax: raise testers = { RDFT.TestTurtlePositiveSyntax: turtle, RDFT.TestTurtleNegativeSyntax: turtle, RDFT.TestTurtleEval: turtle, RDFT.TestTurtleNegativeEval: turtle } 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 else: continue yield t if __name__ == '__main__': verbose = True nose_tst_earl_report(test_turtle, 'rdflib_turtle')
assert isomorphic(g, res), 'graphs must be the same' except: if test.syntax: raise testers = { RDFT.TestTrigPositiveSyntax: trig, RDFT.TestTrigNegativeSyntax: trig, RDFT.TestTrigEval: trig, RDFT.TestTrigNegativeEval: trig } def test_trig(tests=None): for t in nose_tests(testers, 'test/w3c/trig/manifest.ttl'): if tests: for test in tests: if test in t[1].uri: break else: continue yield t if __name__ == '__main__': verbose = True nose_tst_earl_report(test_trig, 'rdflib_trig')
try: g.parse(test.action, format='nquads') if not test.syntax: raise AssertionError("Input shouldn't have parsed!") except: if test.syntax: raise testers = { RDFT.TestNQuadsPositiveSyntax: nquads, RDFT.TestNQuadsNegativeSyntax: nquads } def test_nquads(tests=None): for t in nose_tests(testers, 'test/w3c/nquads/manifest.ttl'): if tests: for test in tests: if test in t[1].uri: break else: continue yield t if __name__ == '__main__': verbose = True nose_tst_earl_report(test_nquads, 'rdflib_nquads')
g = ConjunctiveGraph() try: g.parse(test.action, format='nquads') if not test.syntax: raise AssertionError("Input shouldn't have parsed!") except: if test.syntax: raise testers = { RDFT.TestNQuadsPositiveSyntax: nquads, RDFT.TestNQuadsNegativeSyntax: nquads } def test_nquads(tests = None): for t in nose_tests(testers, 'test/w3c/nquads/manifest.ttl'): if tests: for test in tests: if test in t[1].uri: break else: continue yield t if __name__ == '__main__': verbose = True nose_tst_earl_report(test_nquads, 'rdflib_nquads')
raise Exception('Graphs do not match!') assert isomorphic(g, res), 'graphs must be the same' except: if test.syntax: raise testers = { RDFT.TestTrigPositiveSyntax: trig, RDFT.TestTrigNegativeSyntax: trig, RDFT.TestTrigEval: trig, RDFT.TestTrigNegativeEval: trig } def test_trig(tests=None): for t in nose_tests(testers, 'test/w3c/trig/manifest.ttl'): if tests: for test in tests: if test in t[1].uri: break else: continue yield t if __name__ == '__main__': verbose = True nose_tst_earl_report(test_trig, 'rdflib_trig')