(self)
| 297 | self.assertEqual(re.match(pat, 'xc8yz').span(), (0, 5)) |
| 298 | |
| 299 | def test_symbolic_groups_errors(self): |
| 300 | self.checkPatternError(r'(?P<a>)(?P<a>)', |
| 301 | "redefinition of group name 'a' as group 2; " |
| 302 | "was group 1") |
| 303 | self.checkPatternError(r'(?P<a>(?P=a))', |
| 304 | "cannot refer to an open group", 10) |
| 305 | self.checkPatternError(r'(?Pxy)', 'unknown extension ?Px') |
| 306 | self.checkPatternError(r'(?P<a>)(?P=a', 'missing ), unterminated name', 11) |
| 307 | self.checkPatternError(r'(?P=', 'missing group name', 4) |
| 308 | self.checkPatternError(r'(?P=)', 'missing group name', 4) |
| 309 | self.checkPatternError(r'(?P=1)', "bad character in group name '1'", 4) |
| 310 | self.checkPatternError(r'(?P=a)', "unknown group name 'a'") |
| 311 | self.checkPatternError(r'(?P=a1)', "unknown group name 'a1'") |
| 312 | self.checkPatternError(r'(?P=a.)', "bad character in group name 'a.'", 4) |
| 313 | self.checkPatternError(r'(?P<)', 'missing >, unterminated name', 4) |
| 314 | self.checkPatternError(r'(?P<a', 'missing >, unterminated name', 4) |
| 315 | self.checkPatternError(r'(?P<', 'missing group name', 4) |
| 316 | self.checkPatternError(r'(?P<>)', 'missing group name', 4) |
| 317 | self.checkPatternError(r'(?P<1>)', "bad character in group name '1'", 4) |
| 318 | self.checkPatternError(r'(?P<a.>)', "bad character in group name 'a.'", 4) |
| 319 | self.checkPatternError(r'(?(', 'missing group name', 3) |
| 320 | self.checkPatternError(r'(?())', 'missing group name', 3) |
| 321 | self.checkPatternError(r'(?(a))', "unknown group name 'a'", 3) |
| 322 | self.checkPatternError(r'(?(-1))', "bad character in group name '-1'", 3) |
| 323 | self.checkPatternError(r'(?(1a))', "bad character in group name '1a'", 3) |
| 324 | self.checkPatternError(r'(?(a.))', "bad character in group name 'a.'", 3) |
| 325 | self.checkPatternError('(?P<©>x)', "bad character in group name '©'", 4) |
| 326 | self.checkPatternError('(?P=©)', "bad character in group name '©'", 4) |
| 327 | self.checkPatternError('(?(©)y)', "bad character in group name '©'", 3) |
| 328 | self.checkPatternError(b'(?P<\xc2\xb5>x)', |
| 329 | r"bad character in group name '\xc2\xb5'", 4) |
| 330 | self.checkPatternError(b'(?P=\xc2\xb5)', |
| 331 | r"bad character in group name '\xc2\xb5'", 4) |
| 332 | self.checkPatternError(b'(?(\xc2\xb5)y)', |
| 333 | r"bad character in group name '\xc2\xb5'", 3) |
| 334 | |
| 335 | def test_symbolic_refs(self): |
| 336 | self.assertEqual(re.sub('(?P<a>x)|(?P<b>y)', r'\g<b>', 'xx'), '') |
nothing calls this directly
no test coverage detected