def match_test(self, pattern, expected, data=None, fcn=re.match): [repatt, ymp] = make_pattern(pattern) word_matches = [] if not data: data = self.data for idx, line in enumerate(data): q = fcn(repatt, line.strip()) if q: print("matched @ %d" % idx) word_matches.append(idx) self.assertEqual(word_matches, expected) return
def match_test(self,pattern,expected,data=None,fcn=re.match): [repatt,ymp] = make_pattern( pattern ) word_matches = [] if not data: data = self.data for idx,line in enumerate(data): q = fcn(repatt,line.strip()) if q: print("matched @ %d"%idx) word_matches.append( idx ) self.assertEqual( word_matches, expected ) return
def test_uyirmei_no6_A2Z(self): pattern = u"[ப-பௌ]+" expected = u"[ப,பா,பி,பீ,பு,பூ,பெ,பே,பை,பொ,போ,பௌ]+" [cpattern, opattern] = make_pattern(pattern) self.assertEqual(opattern, expected)
def test_basic_no5_A2Z(self): pattern = u"^[க்-ம்]+" expected = u"^[க்,ச்,ட்,த்,ப்,ற்,ஞ்,ங்,ண்,ந்,ம்]+" [cpattern, opattern] = make_pattern(pattern) self.assertEqual(opattern, expected)
def test_basic_no4_A2Z(self): pattern = u"^[அ-ஔ][0-9]+" expected = u"^[அ,ஆ,இ,ஈ,உ,ஊ,எ,ஏ,ஐ,ஒ,ஓ,ஔ][0-9]+" [cpattern, opattern] = make_pattern(pattern) self.assertEqual(opattern, expected)
def test_basic_no2_A2Z(self): pattern = u"^[அ-உ]+" expected = u"^[அ,ஆ,இ,ஈ,உ]+" [cpattern, opattern] = make_pattern(pattern) self.assertEqual(opattern, expected)
def test_uyirmei_no6_A2Z( self ): pattern = u"[ப-பௌ]+" expected = u"[ப,பா,பி,பீ,பு,பூ,பெ,பே,பை,பொ,போ,பௌ]+" [cpattern,opattern] = make_pattern( pattern ) self.assertEqual( opattern, expected )
def test_basic_no5_A2Z( self ): pattern = u"^[க்-ம்]+" expected = u"^[க்,ச்,ட்,த்,ப்,ற்,ஞ்,ங்,ண்,ந்,ம்]+" [cpattern,opattern] = make_pattern( pattern ) self.assertEqual( opattern, expected )
def test_basic_no4_A2Z( self ): pattern = u"^[அ-ஔ][0-9]+" expected = u"^[அ,ஆ,இ,ஈ,உ,ஊ,எ,ஏ,ஐ,ஒ,ஓ,ஔ][0-9]+" [cpattern,opattern] = make_pattern( pattern ) self.assertEqual( opattern, expected )
def test_basic_no2_A2Z( self ): pattern = u"^[அ-உ]+" expected = u"^[அ,ஆ,இ,ஈ,உ]+" [cpattern,opattern] = make_pattern( pattern ) self.assertEqual( opattern, expected )