예제 #1
0
 def test__match_09(self):
     gd = dict()
     m = functions_.match(r'(?P<w1>\w+) (?P<w2>\w+) (?P<w3>\w+)', ' this is text ', groupdict = gd)
     self.assertIsNone(m)
     self.assertEqual(gd, dict())
예제 #2
0
 def test__match_08(self):
     gd = dict()
     m = functions_.match(r'(?P<w1>\w+) (?P<w2>\w+) (?P<w3>\w+)', 'this is text', groupdict = gd)
     self.assertTrue(m)
     self.assertEqual(gd, {'w1' : 'this', 'w2' : 'is', 'w3' : 'text'})
예제 #3
0
 def test__match_06(self):
     m = functions_.match(r'this is text', '  this is text  ')
     self.assertIsNone(m)
예제 #4
0
 def test__match_07(self):
     m = functions_.match(r'this is text', '  this is text  ', strip = True)
     self.assertTrue(m)
     self.assertEqual(m.span(), (0,12))
예제 #5
0
 def test__match_04(self):
     m = functions_.match(re.compile(r'this is'), 'this is text')
     self.assertTrue(m)
     self.assertEqual(m.span(), (0,7))