diff options
author | Nicholas Car <nicholas.car@surroundaustralia.com> | 2020-07-30 15:10:55 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-30 15:10:55 +1000 |
commit | 7c7f7638ffca9ad5ff953f4f437deca12686c10f (patch) | |
tree | 95480000b89288b52c16fc694ff2d5b3f7ac0ad0 | |
parent | e4fe0fdbd4de7e1183418f302315b51a14602e03 (diff) | |
parent | 63a825f2210345e49e2ef0eff103c83eed067be8 (diff) | |
download | rdflib-7c7f7638ffca9ad5ff953f4f437deca12686c10f.tar.gz |
Merge pull request #1044 from aayush17002/patch-1
Updating namespace.py to solve issue #801
-rw-r--r-- | rdflib/namespace.py | 2 | ||||
-rw-r--r-- | test/test_issue801.py | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/rdflib/namespace.py b/rdflib/namespace.py index 84cbe508..27f6d9ea 100644 --- a/rdflib/namespace.py +++ b/rdflib/namespace.py @@ -804,7 +804,7 @@ class NamespaceManager(object): NAME_START_CATEGORIES = ["Ll", "Lu", "Lo", "Lt", "Nl"] SPLIT_START_CATEGORIES = NAME_START_CATEGORIES + ["Nd"] NAME_CATEGORIES = NAME_START_CATEGORIES + ["Mc", "Me", "Mn", "Lm", "Nd"] -ALLOWED_NAME_CHARS = [u"\u00B7", u"\u0387", u"-", u".", u"_", u":"] +ALLOWED_NAME_CHARS = [u"\u00B7", u"\u0387", u"-", u".", u"_", u":", u"%"] # http://www.w3.org/TR/REC-xml-names/#NT-NCName diff --git a/test/test_issue801.py b/test/test_issue801.py new file mode 100644 index 00000000..ae27f346 --- /dev/null +++ b/test/test_issue801.py @@ -0,0 +1,19 @@ +""" +Issue 801 - Problem with prefixes created for URIs containing %20 +""" +from rdflib import Namespace, Graph, BNode, Literal +import unittest + +class TestIssue801(unittest.TestCase): + + def test_issue_801(self): + g = Graph() + example = Namespace('http://example.org/') + g.bind('', example) + node = BNode() + g.add((node, example['first%20name'], Literal('John'))) + self.assertEqual(g.serialize(format="turtle").decode().split("\n")[-3], + '[] :first%20name "John" .') + +if __name__ == "__main__": + unittest.main() |