Skip to content

Commit

Permalink
test: convert test/test_sparql/test_sparql_parser.py to pytest (#2063)
Browse files Browse the repository at this point in the history
Most straight forward conversion from `unittest` to `pytest`.
  • Loading branch information
aucampia committed Jul 29, 2022
1 parent b24d0c8 commit ff41218
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions test/test_sparql/test_sparql_parser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import math
import sys
import unittest
from typing import Set, Tuple

from rdflib import Graph, Literal
Expand All @@ -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
Expand All @@ -38,13 +37,8 @@ def do_insert(self, resource_count: int) -> None:
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)

0 comments on commit ff41218

Please sign in to comment.