def test_validating_uriquote(self): ntriples.validate = True uniquot = """<http://www.w3.org/People/Berners-Lee/card#cm> <http://xmlns.com/foaf/0.1/name> "R\\u00E4ksm\\u00F6rg\\u00E5s" <http://www.w3.org/People/Berners-Lee/card> .""" res = ntriples.uriquote(uniquot) # revert to default ntriples.validate = False self.assertEqual(res, uniquot)
def test_nonvalidating_uriquote(self): ntriples.validate = False safe = """<http://example.org/alice/foaf.rdf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://example.org/alice/foaf1.rdf> .""" res = ntriples.uriquote(safe) self.assert_(res == safe)
def test_nonvalidating_uriquote(self): ntriples.validate = False safe = """<http://example.org/alice/foaf.rdf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://example.org/alice/foaf1.rdf> .""" res = ntriples.uriquote(safe) self.assertTrue(res == safe)