MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_unicode_doctest

Method test_unicode_doctest

testing/test_doctest.py:725–745  ·  view source on GitHub ↗

Test case for issue 2434: DecodeError on Python 2 when doctest contains non-ascii characters.

(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

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 """

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
maketxtfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected