Back to index

python3.2  3.2.2
Public Member Functions
test.test_normalization.NormalizationTest Class Reference

List of all members.

Public Member Functions

def test_main
def test_bug_834676

Detailed Description

Definition at line 38 of file test_normalization.py.


Member Function Documentation

Definition at line 95 of file test_normalization.py.

00095 
00096     def test_bug_834676(self):
00097         # Check for bug 834676
00098         normalize('NFC', '\ud55c\uae00')
00099 

Here is the call graph for this function:

Definition at line 39 of file test_normalization.py.

00039 
00040     def test_main(self):
00041         part = None
00042         part1_data = {}
00043         # Hit the exception early
00044         try:
00045             testdata = open_urlresource(TESTDATAURL, encoding="utf-8",
00046                                         check=check_version)
00047         except (IOError, HTTPException):
00048             self.skipTest("Could not retrieve " + TESTDATAURL)
00049         self.addCleanup(testdata.close)
00050         for line in testdata:
00051             if '#' in line:
00052                 line = line.split('#')[0]
00053             line = line.strip()
00054             if not line:
00055                 continue
00056             if line.startswith("@Part"):
00057                 part = line.split()[0]
00058                 continue
00059             try:
00060                 c1,c2,c3,c4,c5 = [unistr(x) for x in line.split(';')[:-1]]
00061             except RangeError:
00062                 # Skip unsupported characters;
00063                 # try atleast adding c1 if we are in part1
00064                 if part == "@Part1":
00065                     try:
00066                         c1 = unistr(line.split(';')[0])
00067                     except RangeError:
00068                         pass
00069                     else:
00070                         part1_data[c1] = 1
00071                 continue
00072 
00073             # Perform tests
00074             self.assertTrue(c2 ==  NFC(c1) ==  NFC(c2) ==  NFC(c3), line)
00075             self.assertTrue(c4 ==  NFC(c4) ==  NFC(c5), line)
00076             self.assertTrue(c3 ==  NFD(c1) ==  NFD(c2) ==  NFD(c3), line)
00077             self.assertTrue(c5 ==  NFD(c4) ==  NFD(c5), line)
00078             self.assertTrue(c4 == NFKC(c1) == NFKC(c2) == \
00079                             NFKC(c3) == NFKC(c4) == NFKC(c5),
00080                             line)
00081             self.assertTrue(c5 == NFKD(c1) == NFKD(c2) == \
00082                             NFKD(c3) == NFKD(c4) == NFKD(c5),
00083                             line)
00084 
00085             # Record part 1 data
00086             if part == "@Part1":
00087                 part1_data[c1] = 1
00088 
00089         # Perform tests for all other data
00090         for c in range(sys.maxunicode+1):
00091             X = chr(c)
00092             if X in part1_data:
00093                 continue
00094             self.assertTrue(X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c)

Here is the call graph for this function:


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