def test_perluniprops_chars_manual(self): perluniprops = corpus.Perluniprops() self.assertListEqual( list(perluniprops.chars('Open_Punctuation'))[:5], [u'(', u'[', u'{', u'\u0f3a', u'\u0f3c']) self.assertListEqual( list(perluniprops.chars('Currency_Symbol'))[:5], [u'$', u'\xa2', u'\xa3', u'\xa4', u'\xa5'])
def test_perluniprops_chars_manual(self): perluniprops = corpus.Perluniprops() self.assertListEqual( list(perluniprops.chars("Open_Punctuation"))[:5], [u"(", u"[", u"{", u"\u0f3a", u"\u0f3c"], ) self.assertListEqual( list(perluniprops.chars("Currency_Symbol"))[:5], [u"$", u"\xa2", u"\xa3", u"\xa4", u"\xa5"], )
def test_perluniprops_chars_sanity_check(self): perluniprops = corpus.Perluniprops() for category in perluniprops.available_categories: if sys.version_info[0] >= 3: # Python 3 with self.subTest(category=category): count = 0 for char in perluniprops.chars(category=category): self.assertIsInstance(char, str) count += 1 self.assertGreater(count, 0) else: self.assertEqual( all( isinstance(char, text_type) for char in perluniprops.chars(category=category)), True)