Home - Summaries: (main) : (py3.11) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

pypy/interpreter/pyparser/test/test_pyparse.py::TestFString::()::test_exception_precedence

self = <pypy.interpreter.pyparser.test.test_pyparse.TestFString instance at 0x7f42d9f708c0>

    def test_exception_precedence(self):
        # Tests for f-string-related error messages even under tokenization errors
        with pytest.raises(SyntaxError) as excinfo:
            self.parse("f'{3!:'")
        assert excinfo.value.msg == "f-string: missing conversion character"
        with pytest.raises(SyntaxError) as excinfo:
            self.parse("f'{\n3!:'")
        assert excinfo.value.msg == "'{' was never closed"
        with pytest.raises(SyntaxError) as excinfo:
            self.parse("f'{3!:")
        assert excinfo.value.msg == "f-string: missing conversion character"
        with pytest.raises(SyntaxError) as excinfo:
            self.parse("f'{\n3!:")
        assert excinfo.value.msg == "f-string: missing conversion character"
    
        exc = pytest.raises(SyntaxError, self.parse, '\n\nf"{$}"').value
        assert exc.msg == "f-string: expecting a valid expression after '{'"
>       assert exc.text == 'f"{$}"\n'
E       assert 'f"{$}"' == 'f"{$}"\n'
E           f"{$}"

interpreter/pyparser/test/test_pyparse.py:591: AssertionError
builder: own-linux-x86-64 build #10880+
test: pypy/interpreter/pyparser/test/test_pyparse.py::TestFString::()::test_exception_precedence