ENH: Make ClosedNamespace extend Namespace by kernc · Pull Request #1213 · RDFLib/rdflib (original) (raw)
20210707T222944 iwana@teekai.zoic.eu.org:~/d/github.com/iafork/rdflib
$ git diff
diff --git a/test/test_namespace.py b/test/test_namespace.py
index 59ff0ece..92b9e495 100644
--- a/test/test_namespace.py
+++ b/test/test_namespace.py
@@ -155,3 +155,8 @@ class NamespacePrefixTest(unittest.TestCase):
ref = URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type')
self.assertTrue(ref in RDF, "_RDFNamespace does not include rdf:type")
+
+ def test_repr(self):
+ ns_str = "http://example.com/name/space"
+ ns = Namespace(ns_str)
+ self.assertEqual(ns_str, f"{ns!r}")
20210707T222949 iwana@teekai.zoic.eu.org:~/d/github.com/iafork/rdflib
$ ^C
20210707T223015 iwana@teekai.zoic.eu.org:~/d/github.com/iafork/rdflib
$ poetry run python run_tests.py --tests test/test_namespace.py
Running nose with: --tests test/test_namespace.py --attr= --where=./ --with-doctest --doctest-extension=.doctest --doctest-tests
.....E....
======================================================================
ERROR: test_repr (test.test_namespace.NamespacePrefixTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/iwana/d/github.com/iafork/rdflib/test/test_namespace.py", line 162, in test_repr
self.assertEqual(ns_str, f"{ns!r}")
File "/home/iwana/d/github.com/iafork/rdflib/rdflib/namespace.py", line 144, in __repr__
return f"Namespace({self!r})"
File "/home/iwana/d/github.com/iafork/rdflib/rdflib/namespace.py", line 144, in __repr__
return f"Namespace({self!r})"
File "/home/iwana/d/github.com/iafork/rdflib/rdflib/namespace.py", line 144, in __repr__
return f"Namespace({self!r})"
[Previous line repeated 235 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object
----------------------------------------------------------------------
Ran 10 tests in 0.005s
FAILED (errors=1)