Back to index

python3.2  3.2.2
Public Member Functions
test.test_stringprep.StringprepTests Class Reference

List of all members.

Public Member Functions

def test

Detailed Description

Definition at line 9 of file test_stringprep.py.


Member Function Documentation

Definition at line 10 of file test_stringprep.py.

00010 
00011     def test(self):
00012         self.assertTrue(in_table_a1("\u0221"))
00013         self.assertFalse(in_table_a1("\u0222"))
00014 
00015         self.assertTrue(in_table_b1("\u00ad"))
00016         self.assertFalse(in_table_b1("\u00ae"))
00017 
00018         self.assertTrue(map_table_b2("\u0041"), "\u0061")
00019         self.assertTrue(map_table_b2("\u0061"), "\u0061")
00020 
00021         self.assertTrue(map_table_b3("\u0041"), "\u0061")
00022         self.assertTrue(map_table_b3("\u0061"), "\u0061")
00023 
00024         self.assertTrue(in_table_c11("\u0020"))
00025         self.assertFalse(in_table_c11("\u0021"))
00026 
00027         self.assertTrue(in_table_c12("\u00a0"))
00028         self.assertFalse(in_table_c12("\u00a1"))
00029 
00030         self.assertTrue(in_table_c12("\u00a0"))
00031         self.assertFalse(in_table_c12("\u00a1"))
00032 
00033         self.assertTrue(in_table_c11_c12("\u00a0"))
00034         self.assertFalse(in_table_c11_c12("\u00a1"))
00035 
00036         self.assertTrue(in_table_c21("\u001f"))
00037         self.assertFalse(in_table_c21("\u0020"))
00038 
00039         self.assertTrue(in_table_c22("\u009f"))
00040         self.assertFalse(in_table_c22("\u00a0"))
00041 
00042         self.assertTrue(in_table_c21_c22("\u009f"))
00043         self.assertFalse(in_table_c21_c22("\u00a0"))
00044 
00045         self.assertTrue(in_table_c3("\ue000"))
00046         self.assertFalse(in_table_c3("\uf900"))
00047 
00048         self.assertTrue(in_table_c4("\uffff"))
00049         self.assertFalse(in_table_c4("\u0000"))
00050 
00051         self.assertTrue(in_table_c5("\ud800"))
00052         self.assertFalse(in_table_c5("\ud7ff"))
00053 
00054         self.assertTrue(in_table_c6("\ufff9"))
00055         self.assertFalse(in_table_c6("\ufffe"))
00056 
00057         self.assertTrue(in_table_c7("\u2ff0"))
00058         self.assertFalse(in_table_c7("\u2ffc"))
00059 
00060         self.assertTrue(in_table_c8("\u0340"))
00061         self.assertFalse(in_table_c8("\u0342"))
00062 
00063         # C.9 is not in the bmp
00064         # self.assertTrue(in_table_c9(u"\U000E0001"))
00065         # self.assertFalse(in_table_c8(u"\U000E0002"))
00066 
00067         self.assertTrue(in_table_d1("\u05be"))
00068         self.assertFalse(in_table_d1("\u05bf"))
00069 
00070         self.assertTrue(in_table_d2("\u0041"))
00071         self.assertFalse(in_table_d2("\u0040"))
00072 
00073         # This would generate a hash of all predicates. However, running
00074         # it is quite expensive, and only serves to detect changes in the
00075         # unicode database. Instead, stringprep.py asserts the version of
00076         # the database.
00077 
00078         # import hashlib
00079         # predicates = [k for k in dir(stringprep) if k.startswith("in_table")]
00080         # predicates.sort()
00081         # for p in predicates:
00082         #     f = getattr(stringprep, p)
00083         #     # Collect all BMP code points
00084         #     data = ["0"] * 0x10000
00085         #     for i in range(0x10000):
00086         #         if f(unichr(i)):
00087         #             data[i] = "1"
00088         #     data = "".join(data)
00089         #     h = hashlib.sha1()
00090         #     h.update(data)
00091         #     print p, h.hexdigest()

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: