refactor: Slight refactor of `test_n3_formula.py`
Just moved things into the test function that is not used outside of it,
and added logging.
+import logging
import pytest
import rdflib
+import rdflib.term
+logger = logging.getLogger(__name__)
+
+
+@pytest.mark.xfail(
+ reason="""\
+N3 serializer randomly omits triple. See https://github.com/RDFLib/rdflib/issues/1807
+""",
+ raises=AssertionError,
+)
+def test():
test_n3 = """@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix : <http://test/> .
{:a :b :c;a :foo} => {:a :d :c,?y} .
_:foo a rdfs:Class .
:a :d :c ."""
-
-@pytest.mark.xfail(reason="N3 serializer randomly omits triple")
-def test():
graph1 = rdflib.Graph()
graph1.parse(data=test_n3, format="n3")
+ if logger.isEnabledFor(logging.DEBUG):
+ logging.debug("sorted(list(graph1)) = \n%s", sorted(list(graph1)))
+
"""
>>> sorted(list(graph1))
[
@@ -39,5 +51,5 @@ def test():
assert (
rdflib.term.URIRef('http://test/a'),
rdflib.term.URIRef('http://test/d'),
- rdflib.term.URIRef('http://test/c')
+ rdflib.term.URIRef('http://test/c'),
) in graph2
