Exemple #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))
Exemple #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))
Exemple #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.")
Exemple #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))