Test case for issue 2434: DecodeError on Python 2 when doctest contains non-ascii characters.
(self, pytester: Pytester)
| 723 | reprec.assertoutcome(failed=1) |
| 724 | |
| 725 | def test_unicode_doctest(self, pytester: Pytester): |
| 726 | """ |
| 727 | Test case for issue 2434: DecodeError on Python 2 when doctest contains non-ascii |
| 728 | characters. |
| 729 | """ |
| 730 | p = pytester.maketxtfile( |
| 731 | test_unicode_doctest=""" |
| 732 | .. doctest:: |
| 733 | |
| 734 | >>> print("Hi\\n\\nByé") |
| 735 | Hi |
| 736 | ... |
| 737 | Byé |
| 738 | >>> 1 / 0 # Byé |
| 739 | 1 |
| 740 | """ |
| 741 | ) |
| 742 | result = pytester.runpytest(p) |
| 743 | result.stdout.fnmatch_lines( |
| 744 | ["*UNEXPECTED EXCEPTION: ZeroDivisionError*", "*1 failed*"] |
| 745 | ) |
| 746 | |
| 747 | def test_unicode_doctest_module(self, pytester: Pytester): |
| 748 | """ |
nothing calls this directly
no test coverage detected