(self)
| 1626 | self.assertIsNone(re.match(r'(?:a?){2,}?y', 'z')) |
| 1627 | |
| 1628 | def test_scanner(self): |
| 1629 | def s_ident(scanner, token): return token |
| 1630 | def s_operator(scanner, token): return "op%s" % token |
| 1631 | def s_float(scanner, token): return float(token) |
| 1632 | def s_int(scanner, token): return int(token) |
| 1633 | |
| 1634 | scanner = Scanner([ |
| 1635 | (r"[a-zA-Z_]\w*", s_ident), |
| 1636 | (r"\d+\.\d*", s_float), |
| 1637 | (r"\d+", s_int), |
| 1638 | (r"=|\+|-|\*|/", s_operator), |
| 1639 | (r"\s+", None), |
| 1640 | ]) |
| 1641 | |
| 1642 | self.assertTrue(scanner.scanner.scanner("").pattern) |
| 1643 | |
| 1644 | self.assertEqual(scanner.scan("sum = 3*foo + 312.50 + bar"), |
| 1645 | (['sum', 'op=', 3, 'op*', 'foo', 'op+', 312.5, |
| 1646 | 'op+', 'bar'], '')) |
| 1647 | |
| 1648 | def test_bug_448951(self): |
| 1649 | # bug 448951 (similar to 429357, but with single char match) |
nothing calls this directly
no test coverage detected