def __get_next_match(self, test_case, pos): with open(test_case, "r") as in_file: prog = in_file.read() config = self.__get_config() m = nestedmatcher.find(config["search"], prog, pos=pos, prefix=config["prefix"]) return m
def test_1(self): m = find(BalancedExpr.parens, 'No match in this string!') self.assertIsNone(m)
def test_10(self): m = find(BalancedExpr.parens, '(This (string) contains) two nested matches!', pos=1) self.assertEqual(m, (6, 14))
def test_11(self): m = find(BalancedExpr.parens, '(This (string) contains) two nested matches!', prefix='This ') self.assertEqual(m, (1, 14))
def test_9(self): m = find(BalancedExpr.parens, '(This (string) contains) two nested matches!') self.assertEqual(m, (0, 24))
def test_8(self): m = find(BalancedExpr.parens, '(This string contains) two (simple matches)!') self.assertEqual(m, (0, 22))
def test_7(self): m = find(BalancedExpr.parens, '(This string contains) a simple match at the beginning!') self.assertEqual(m, (0, 22))
def test_6(self): m = find(BalancedExpr.parens, 'This string contains a (simple match at the end!)') self.assertEqual(m, (23, 49))
def test_5(self): m = find(BalancedExpr.parens, 'This string contains a (simple match)!') self.assertEqual(m, (23, 37))