diff options
author | darylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-04-16 22:12:42 +0000 |
---|---|---|
committer | darylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-04-16 22:12:42 +0000 |
commit | 4710c53dcad1ebf3755f3efb9e80ac24bd72a9b2 (patch) | |
tree | 2d17d2388a78082e32f6a97120d707328143543b /AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_stringprep.py | |
parent | cbc6b5e54599c7391ece99ad3c5313f4dd4ddda6 (diff) | |
download | edk2-platforms-4710c53dcad1ebf3755f3efb9e80ac24bd72a9b2.tar.xz |
AppPkg/Applications/Python: Add Python 2.7.2 sources since the release of Python 2.7.3 made them unavailable from the python.org web site.
These files are a subset of the python-2.7.2.tgz distribution from python.org. Changed files from PyMod-2.7.2 have been copied into the corresponding directories of this tree, replacing the original files in the distribution.
Signed-off-by: daryl.mcdaniel@intel.com
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13197 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_stringprep.py')
-rw-r--r-- | AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_stringprep.py | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_stringprep.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_stringprep.py new file mode 100644 index 0000000000..d66e77712f --- /dev/null +++ b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_stringprep.py @@ -0,0 +1,96 @@ +# To fully test this module, we would need a copy of the stringprep tables.
+# Since we don't have them, this test checks only a few codepoints.
+
+import unittest
+from test import test_support
+
+from stringprep import *
+
+class StringprepTests(unittest.TestCase):
+ def test(self):
+ self.assertTrue(in_table_a1(u"\u0221"))
+ self.assertFalse(in_table_a1(u"\u0222"))
+
+ self.assertTrue(in_table_b1(u"\u00ad"))
+ self.assertFalse(in_table_b1(u"\u00ae"))
+
+ self.assertTrue(map_table_b2(u"\u0041"), u"\u0061")
+ self.assertTrue(map_table_b2(u"\u0061"), u"\u0061")
+
+ self.assertTrue(map_table_b3(u"\u0041"), u"\u0061")
+ self.assertTrue(map_table_b3(u"\u0061"), u"\u0061")
+
+ self.assertTrue(in_table_c11(u"\u0020"))
+ self.assertFalse(in_table_c11(u"\u0021"))
+
+ self.assertTrue(in_table_c12(u"\u00a0"))
+ self.assertFalse(in_table_c12(u"\u00a1"))
+
+ self.assertTrue(in_table_c12(u"\u00a0"))
+ self.assertFalse(in_table_c12(u"\u00a1"))
+
+ self.assertTrue(in_table_c11_c12(u"\u00a0"))
+ self.assertFalse(in_table_c11_c12(u"\u00a1"))
+
+ self.assertTrue(in_table_c21(u"\u001f"))
+ self.assertFalse(in_table_c21(u"\u0020"))
+
+ self.assertTrue(in_table_c22(u"\u009f"))
+ self.assertFalse(in_table_c22(u"\u00a0"))
+
+ self.assertTrue(in_table_c21_c22(u"\u009f"))
+ self.assertFalse(in_table_c21_c22(u"\u00a0"))
+
+ self.assertTrue(in_table_c3(u"\ue000"))
+ self.assertFalse(in_table_c3(u"\uf900"))
+
+ self.assertTrue(in_table_c4(u"\uffff"))
+ self.assertFalse(in_table_c4(u"\u0000"))
+
+ self.assertTrue(in_table_c5(u"\ud800"))
+ self.assertFalse(in_table_c5(u"\ud7ff"))
+
+ self.assertTrue(in_table_c6(u"\ufff9"))
+ self.assertFalse(in_table_c6(u"\ufffe"))
+
+ self.assertTrue(in_table_c7(u"\u2ff0"))
+ self.assertFalse(in_table_c7(u"\u2ffc"))
+
+ self.assertTrue(in_table_c8(u"\u0340"))
+ self.assertFalse(in_table_c8(u"\u0342"))
+
+ # C.9 is not in the bmp
+ # self.assertTrue(in_table_c9(u"\U000E0001"))
+ # self.assertFalse(in_table_c8(u"\U000E0002"))
+
+ self.assertTrue(in_table_d1(u"\u05be"))
+ self.assertFalse(in_table_d1(u"\u05bf"))
+
+ self.assertTrue(in_table_d2(u"\u0041"))
+ self.assertFalse(in_table_d2(u"\u0040"))
+
+ # This would generate a hash of all predicates. However, running
+ # it is quite expensive, and only serves to detect changes in the
+ # unicode database. Instead, stringprep.py asserts the version of
+ # the database.
+
+ # import hashlib
+ # predicates = [k for k in dir(stringprep) if k.startswith("in_table")]
+ # predicates.sort()
+ # for p in predicates:
+ # f = getattr(stringprep, p)
+ # # Collect all BMP code points
+ # data = ["0"] * 0x10000
+ # for i in range(0x10000):
+ # if f(unichr(i)):
+ # data[i] = "1"
+ # data = "".join(data)
+ # h = hashlib.sha1()
+ # h.update(data)
+ # print p, h.hexdigest()
+
+def test_main():
+ test_support.run_unittest(StringprepTests)
+
+if __name__ == '__main__':
+ test_main()
|