|
6 | 6 | import pickle |
7 | 7 | import random |
8 | 8 | import re |
| 9 | +import string |
9 | 10 | import subprocess |
10 | 11 | import sys |
11 | 12 | import sysconfig |
@@ -489,6 +490,37 @@ def test_skipitem(self): |
489 | 490 | c, i, when_skipped, when_not_skipped)) |
490 | 491 | self.assertIs(when_skipped, when_not_skipped, message) |
491 | 492 |
|
| 493 | + def test_skipitem_with_suffix(self): |
| 494 | + parse = _testcapi.parse_tuple_and_keywords |
| 495 | + empty_tuple = () |
| 496 | + tuple_1 = (0,) |
| 497 | + dict_b = {'b':1} |
| 498 | + keywords = ["a", "b"] |
| 499 | + |
| 500 | + supported = ('s#', 's*', 'z#', 'z*', 'u#', 'Z#', 'y#', 'y*', 'w#', 'w*') |
| 501 | + for c in string.ascii_letters: |
| 502 | + for c2 in '#*': |
| 503 | + f = c + c2 |
| 504 | + with self.subTest(format=f): |
| 505 | + optional_format = "|" + f + "i" |
| 506 | + if f in supported: |
| 507 | + parse(empty_tuple, dict_b, optional_format, keywords) |
| 508 | + else: |
| 509 | + with self.assertRaisesRegex(SystemError, |
| 510 | + 'impossible<bad format char>'): |
| 511 | + parse(empty_tuple, dict_b, optional_format, keywords) |
| 512 | + |
| 513 | + for c in map(chr, range(32, 128)): |
| 514 | + f = 'e' + c |
| 515 | + optional_format = "|" + f + "i" |
| 516 | + with self.subTest(format=f): |
| 517 | + if c in 'st': |
| 518 | + parse(empty_tuple, dict_b, optional_format, keywords) |
| 519 | + else: |
| 520 | + with self.assertRaisesRegex(SystemError, |
| 521 | + 'impossible<bad format char>'): |
| 522 | + parse(empty_tuple, dict_b, optional_format, keywords) |
| 523 | + |
492 | 524 | def test_parse_tuple_and_keywords(self): |
493 | 525 | # Test handling errors in the parse_tuple_and_keywords helper itself |
494 | 526 | self.assertRaises(TypeError, _testcapi.parse_tuple_and_keywords, |
|
0 commit comments