Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
test.test_unicodedata.UnicodeMethodsTest Class Reference

Run tests. More...

Collaboration diagram for test.test_unicodedata.UnicodeMethodsTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_method_checksum

Static Public Attributes

string expectedchecksum = '21b90f1aed00081b81ca7942b22196af090015a0'

Detailed Description

Run tests.

Definition at line 21 of file test_unicodedata.py.


Member Function Documentation

Definition at line 26 of file test_unicodedata.py.

00026 
00027     def test_method_checksum(self):
00028         h = hashlib.sha1()
00029         for i in range(0x10000):
00030             char = chr(i)
00031             data = [
00032                 # Predicates (single char)
00033                 "01"[char.isalnum()],
00034                 "01"[char.isalpha()],
00035                 "01"[char.isdecimal()],
00036                 "01"[char.isdigit()],
00037                 "01"[char.islower()],
00038                 "01"[char.isnumeric()],
00039                 "01"[char.isspace()],
00040                 "01"[char.istitle()],
00041                 "01"[char.isupper()],
00042 
00043                 # Predicates (multiple chars)
00044                 "01"[(char + 'abc').isalnum()],
00045                 "01"[(char + 'abc').isalpha()],
00046                 "01"[(char + '123').isdecimal()],
00047                 "01"[(char + '123').isdigit()],
00048                 "01"[(char + 'abc').islower()],
00049                 "01"[(char + '123').isnumeric()],
00050                 "01"[(char + ' \t').isspace()],
00051                 "01"[(char + 'abc').istitle()],
00052                 "01"[(char + 'ABC').isupper()],
00053 
00054                 # Mappings (single char)
00055                 char.lower(),
00056                 char.upper(),
00057                 char.title(),
00058 
00059                 # Mappings (multiple chars)
00060                 (char + 'abc').lower(),
00061                 (char + 'ABC').upper(),
00062                 (char + 'abc').title(),
00063                 (char + 'ABC').title(),
00064 
00065                 ]
00066             h.update(''.join(data).encode(encoding, errors))
00067         result = h.hexdigest()
00068         self.assertEqual(result, self.expectedchecksum)

Here is the call graph for this function:


Member Data Documentation

string test.test_unicodedata.UnicodeMethodsTest.expectedchecksum = '21b90f1aed00081b81ca7942b22196af090015a0' [static]

Definition at line 24 of file test_unicodedata.py.


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