Example #1
0
 def test_unicode_categories(self):
     self.assertEqual(sum(len(v) for k, v in UNICODE_CATEGORIES.items() if len(k) > 1),
                      sys.maxunicode + 1)
     self.assertEqual(min([min(s) for s in UNICODE_CATEGORIES.values()]), 0)
     self.assertEqual(max([max(s) for s in UNICODE_CATEGORIES.values()]), sys.maxunicode)
     base_sets = [set(v) for k, v in UNICODE_CATEGORIES.items() if len(k) > 1]
     self.assertFalse(any(s.intersection(t) for s in base_sets for t in base_sets if s != t))
Example #2
0
 def test_conjunctions(self):
     n_code_points = sum(
         len(v) for k, v in UNICODE_CATEGORIES.items() if len(k) > 1)
     self.assertTrue(
         n_code_points == sys.maxunicode + 1,
         "The Unicode categories have a wrong number of elements: %d (!= %d) "
         % (n_code_points, sys.maxunicode + 1))
Example #3
0
 def test_disjunction(self):
     base_sets = [v for k, v in UNICODE_CATEGORIES.items() if len(k) > 1]
     self.assertFalse(
         any([
             s.intersection(t) for s in base_sets for t in base_sets
             if s != t
         ]), "The Unicode categories are not mutually disjoined.")
Example #4
0
 def test_conjunctions(self):
     n_code_points = len(
         set.union(
             *[v for k, v in UNICODE_CATEGORIES.items() if len(k) > 1]))
     self.assertTrue(
         n_code_points == maxunicode + 1,
         "The Unicode categories have a wrong number of elements: %d (!= %d) "
         % (n_code_points, maxunicode + 1))
Example #5
0
 def test_min_value(self):
     min_code_point = min([min(s) for s in UNICODE_CATEGORIES.values()])
     self.assertTrue(
         min_code_point >= 0,
         "The Unicode categories have negative code points: %d" %
         min_code_point)
Example #6
0
 def test_max_value(self):
     max_code_point = max([max(s) for s in UNICODE_CATEGORIES.values()])
     self.assertTrue(
         max_code_point <= sys.maxunicode,
         "The Unicode categories have a code point greater than %d: %d" %
         (sys.maxunicode, max_code_point))