def test_cpc(self): for cpc in self.cpcchar: l = unicodedata.normalize("NFKD", cpc) self.assertFalse(uchar.isModernChoseong(cpc), msg=cpc) self.assertFalse(uchar.isChoseongJamo(cpc), msg=cpc) self.assertFalse(uchar.isModernJungseong(cpc), msg=cpc) self.assertFalse(uchar.isJungseongJamo(cpc), msg=cpc) self.assertFalse(uchar.isModernJongseong(cpc), msg=cpc) self.assertFalse(uchar.isOldJongseong(cpc), msg=cpc) self.assertFalse(uchar.isJongseongJamo(cpc), msg=cpc) self.assertFalse(uchar.isHangulJamo(cpc), msg=cpc) self.assertFalse(uchar.isHalfwidthLetter(cpc), msg=cpc) self.assertTrue(uchar.isCompatibilityLetter(cpc), msg=cpc) self.assertFalse(uchar.isParenthesizedLetter(cpc), msg=cpc) self.assertFalse(uchar.isCircledLetter(cpc), msg=cpc) self.assertFalse(uchar.isPrecomposedSyllable(cpc), msg=cpc) self.assertTrue(uchar.isHangulLetter(cpc), msg=cpc) if uchar.isChoseongJamo(l): self.assertEqual(normalization.normalizeJamoKDKC(cpc), l + six.chr(int("1160", 16))) else: self.assertEqual( normalization.normalizeJamoKDKC(cpc), six.chr(int("115F", 16)) + six.chr(int("1160", 16)) + l)
def test_uchar(self): for l in self.old_lchar: self.assertFalse(uchar.isModernChoseong(l), msg=l) self.assertTrue(uchar.isChoseongJamo(l), msg=l) self.assertFalse(uchar.isModernJungseong(l), msg=l) self.assertFalse(uchar.isJungseongJamo(l), msg=l) self.assertFalse(uchar.isModernJongseong(l), msg=l) self.assertFalse(uchar.isOldJongseong(l), msg=l) self.assertFalse(uchar.isJongseongJamo(l), msg=l) self.assertTrue(uchar.isHangulJamo(l), msg=l) self.assertFalse(uchar.isHalfwidthLetter(l), msg=l) self.assertFalse(uchar.isCompatibilityLetter(l), msg=l) self.assertFalse(uchar.isParenthesizedLetter(l), msg=l) self.assertFalse(uchar.isCircledLetter(l), msg=l) self.assertFalse(uchar.isPrecomposedSyllable(l), msg=l) self.assertTrue(uchar.isHangulLetter(l), msg=l) for v in self.old_vchar: self.assertFalse(uchar.isModernChoseong(v), msg=v) self.assertFalse(uchar.isChoseongJamo(v), msg=v) self.assertFalse(uchar.isModernJungseong(v), msg=v) self.assertTrue(uchar.isJungseongJamo(v), msg=v) self.assertFalse(uchar.isModernJongseong(v), msg=v) self.assertFalse(uchar.isOldJongseong(v), msg=v) self.assertFalse(uchar.isJongseongJamo(v), msg=v) self.assertTrue(uchar.isHangulJamo(v), msg=v) self.assertFalse(uchar.isHalfwidthLetter(v), msg=v) self.assertFalse(uchar.isCompatibilityLetter(v), msg=v) self.assertFalse(uchar.isParenthesizedLetter(v), msg=v) self.assertFalse(uchar.isCircledLetter(v), msg=v) self.assertFalse(uchar.isPrecomposedSyllable(v), msg=v) self.assertTrue(uchar.isHangulLetter(v), msg=v) for t in self.old_tchar: self.assertFalse(uchar.isModernChoseong(t), msg=t) self.assertFalse(uchar.isChoseongJamo(t), msg=t) self.assertFalse(uchar.isModernJungseong(t), msg=t) self.assertFalse(uchar.isJungseongJamo(t), msg=t) self.assertFalse(uchar.isModernJongseong(t), msg=t) self.assertTrue(uchar.isOldJongseong(t), msg=t) self.assertTrue(uchar.isJongseongJamo(t), msg=t) self.assertTrue(uchar.isHangulJamo(t), msg=t) self.assertFalse(uchar.isHalfwidthLetter(t), msg=t) self.assertFalse(uchar.isCompatibilityLetter(t), msg=t) self.assertFalse(uchar.isParenthesizedLetter(t), msg=t) self.assertFalse(uchar.isCircledLetter(t), msg=t) self.assertFalse(uchar.isPrecomposedSyllable(t), msg=t) self.assertTrue(uchar.isHangulLetter(t), msg=t)
def test_circled(self): for c in self.circled: self.assertFalse(uchar.isModernChoseong(c), msg=c) self.assertFalse(uchar.isChoseongJamo(c), msg=c) self.assertFalse(uchar.isModernJungseong(c), msg=c) self.assertFalse(uchar.isJungseongJamo(c), msg=c) self.assertFalse(uchar.isModernJongseong(c), msg=c) self.assertFalse(uchar.isOldJongseong(c), msg=c) self.assertFalse(uchar.isJongseongJamo(c), msg=c) self.assertFalse(uchar.isHangulJamo(c), msg=c) self.assertFalse(uchar.isHalfwidthLetter(c), msg=c) self.assertFalse(uchar.isCompatibilityLetter(c), msg=c) self.assertFalse(uchar.isParenthesizedLetter(c), msg=c) self.assertTrue(uchar.isCircledLetter(c), msg=c) self.assertFalse(uchar.isPrecomposedSyllable(c), msg=c) self.assertTrue(uchar.isHangulLetter(c), msg=c) cc1 = unicodedata.normalize("NFKC", c) cc2 = normalization.normalizeJamoKDKC(c) if uchar.isModernChoseong(cc2[0]): self.assertEqual(cc1 + "\u1160", cc2)
def test_parenthesized(self): for p in self.parenthesized: self.assertFalse(uchar.isModernChoseong(p), msg=p) self.assertFalse(uchar.isChoseongJamo(p), msg=p) self.assertFalse(uchar.isModernJungseong(p), msg=p) self.assertFalse(uchar.isJungseongJamo(p), msg=p) self.assertFalse(uchar.isModernJongseong(p), msg=p) self.assertFalse(uchar.isOldJongseong(p), msg=p) self.assertFalse(uchar.isJongseongJamo(p), msg=p) self.assertFalse(uchar.isHangulJamo(p), msg=p) self.assertFalse(uchar.isHalfwidthLetter(p), msg=p) self.assertFalse(uchar.isCompatibilityLetter(p), msg=p) self.assertTrue(uchar.isParenthesizedLetter(p), msg=p) self.assertFalse(uchar.isCircledLetter(p), msg=p) self.assertFalse(uchar.isPrecomposedSyllable(p), msg=p) self.assertTrue(uchar.isHangulLetter(p), msg=p) pp1 = unicodedata.normalize("NFKC", p) pp2 = normalization.normalizeJamoKDKC(p) if len(pp2) > 1 and uchar.isModernChoseong(pp2[1]): self.assertEqual(pp1[:2] + "\u1160" + pp1[-1], pp2)
def test_jongseong(self): for t in self.tchar: self.assertFalse(uchar.isModernChoseong(t), msg=t) self.assertFalse(uchar.isChoseongJamo(t), msg=t) self.assertFalse(uchar.isModernJungseong(t), msg=t) self.assertFalse(uchar.isJungseongJamo(t), msg=t) self.assertTrue(uchar.isModernJongseong(t), msg=t) self.assertFalse(uchar.isOldJongseong(t), msg=t) self.assertTrue(uchar.isJongseongJamo(t), msg=t) self.assertTrue(uchar.isHangulJamo(t), msg=t) self.assertFalse(uchar.isHalfwidthLetter(t), msg=t) self.assertFalse(uchar.isCompatibilityLetter(t), msg=t) self.assertFalse(uchar.isParenthesizedLetter(t), msg=t) self.assertFalse(uchar.isCircledLetter(t), msg=t) self.assertFalse(uchar.isPrecomposedSyllable(t), msg=t) self.assertTrue(uchar.isHangulLetter(t), msg=t)