test: convert `test/test_sparql/test_sparql_parser.py` to pytest
Most straight forward conversion from `unittest` to `pytest`.
import math
import sys
-import unittest
from typing import Set, Tuple
from rdflib import Graph, Literal
@@ -13,7 +12,7 @@ def triple_set(graph: Graph) -> Set[Tuple[Node, Node, Node]]:
return set(graph.triples((None, None, None)))
-class SPARQLParserTests(unittest.TestCase):
+class TestSPARQLParser:
def test_insert_recursionlimit(self) -> None:
# These values are experimentally determined
# to cause the RecursionError reported in
@@ -38,13 +37,8 @@ class SPARQLParserTests(unittest.TestCase):
g0ntriples = g0.serialize(format="ntriples")
g1 = Graph()
- self.assertNotEqual(triple_set(g0), triple_set(g1))
+ assert triple_set(g0) != triple_set(g1)
processUpdate(g1, f"INSERT DATA {{ {g0ntriples!s} }}")
- self.assertEqual(triple_set(g0), triple_set(g1))
-
-
-if __name__ == "__main__":
-
- unittest.main()
+ assert triple_set(g0) == triple_set(g1)
