|
5 | 5 | import pickle |
6 | 6 | import random |
7 | 7 | import re |
| 8 | +import string |
8 | 9 | import subprocess |
9 | 10 | import sys |
10 | 11 | import sysconfig |
@@ -565,6 +566,37 @@ def test_skipitem(self): |
565 | 566 | c, i, when_skipped, when_not_skipped)) |
566 | 567 | self.assertIs(when_skipped, when_not_skipped, message) |
567 | 568 |
|
| 569 | + def test_skipitem_with_suffix(self): |
| 570 | + parse = _testcapi.parse_tuple_and_keywords |
| 571 | + empty_tuple = () |
| 572 | + tuple_1 = (0,) |
| 573 | + dict_b = {'b':1} |
| 574 | + keywords = ["a", "b"] |
| 575 | + |
| 576 | + supported = ('s#', 's*', 'z#', 'z*', 'u#', 'Z#', 'y#', 'y*', 'w#', 'w*') |
| 577 | + for c in string.ascii_letters: |
| 578 | + for c2 in '#*': |
| 579 | + f = c + c2 |
| 580 | + with self.subTest(format=f): |
| 581 | + optional_format = "|" + f + "i" |
| 582 | + if f in supported: |
| 583 | + parse(empty_tuple, dict_b, optional_format, keywords) |
| 584 | + else: |
| 585 | + with self.assertRaisesRegex(SystemError, |
| 586 | + 'impossible<bad format char>'): |
| 587 | + parse(empty_tuple, dict_b, optional_format, keywords) |
| 588 | + |
| 589 | + for c in map(chr, range(32, 128)): |
| 590 | + f = 'e' + c |
| 591 | + optional_format = "|" + f + "i" |
| 592 | + with self.subTest(format=f): |
| 593 | + if c in 'st': |
| 594 | + parse(empty_tuple, dict_b, optional_format, keywords) |
| 595 | + else: |
| 596 | + with self.assertRaisesRegex(SystemError, |
| 597 | + 'impossible<bad format char>'): |
| 598 | + parse(empty_tuple, dict_b, optional_format, keywords) |
| 599 | + |
568 | 600 | def test_parse_tuple_and_keywords(self): |
569 | 601 | # Test handling errors in the parse_tuple_and_keywords helper itself |
570 | 602 | self.assertRaises(TypeError, _testcapi.parse_tuple_and_keywords, |
|
0 commit comments