def test_docstring_partial_context_around_error(self, pytester: Pytester):
        """Test that we show some context before the actual line of a failing
        doctest.
        """
        pytester.makepyfile(
            '''
            def foo():
                """
                text-line-1
                text-line-2
                text-line-3
                text-line-4
                text-line-5
                text-line-6
                text-line-7
                text-line-8
                text-line-9
                text-line-10
                text-line-11
                >>> 1 + 1
                3

                text-line-after
                """
        '''
        )
        result = pytester.runpytest("--doctest-modules")
        result.stdout.fnmatch_lines(
            [
                "*docstring_partial_context_around_error*",
                "005*text-line-3",
                "006*text-line-4",
                "013*text-line-11",
                "014*>>> 1 + 1",
                "Expected:",
                "    3",
                "Got:",
                "    2",
            ]
        )
        # lines below should be trimmed out
        result.stdout.no_fnmatch_line("*text-line-2*")
        result.stdout.no_fnmatch_line("*text-line-after*")
Test that we show some context before the actual line of a failing
        doctest.
        
testing/test_doctest.py