summaryrefslogtreecommitdiff
path: root/test/test_normalizedString.py
diff options
context:
space:
mode:
authorbhadoo-aditya <44553897+bhadoo-aditya@users.noreply.github.com>2020-05-29 21:52:45 +0530
committerGitHub <noreply@github.com>2020-05-29 21:52:45 +0530
commitcc109dee42d9a221ebba9caae8cc5c8b6bba4351 (patch)
tree0cc7fc543f7b0a9d9821ab0fc2d4a63a7369e648 /test/test_normalizedString.py
parent037ea51e5f4863a7f98ff59972fcd34d39a7ed97 (diff)
downloadrdflib-cc109dee42d9a221ebba9caae8cc5c8b6bba4351.tar.gz
Test cases for normalized string
Diffstat (limited to 'test/test_normalizedString.py')
-rw-r--r--test/test_normalizedString.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_normalizedString.py b/test/test_normalizedString.py
new file mode 100644
index 00000000..907e7e7d
--- /dev/null
+++ b/test/test_normalizedString.py
@@ -0,0 +1,23 @@
+from rdflib import *
+import unittest
+
+class test_normalisedString(unittest.TestCase):
+ def test1(self):
+ lit2 = Literal("\two\nw", datatype=XSD.normalizedString)
+ lit = Literal("\two\nw", datatype=XSD.string)
+ self.assertEqual(lit == lit2, False)
+
+ def test2(self):
+ lit = Literal("\tBeing a Doctor Is\n\ta Full-Time Job\r", datatype=XSD.normalizedString)
+ st = Literal(" Being a Doctor Is a Full-Time Job ", datatype=XSD.string)
+ self.assertFalse(Literal.eq(st,lit))
+
+ def test3(self):
+ lit=Literal("hey\nthere", datatype=XSD.normalizedString).n3()
+ print(lit)
+ self.assertTrue(lit=="\"hey there\"^^<http://www.w3.org/2001/XMLSchema#normalizedString>")
+
+
+
+if __name__ == "__main__":
+ unittest.main() \ No newline at end of file