From d4ed4bf02c0589a35303edeecf0f920997947bf2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 3 Jun 2024 10:22:57 +0200 Subject: [PATCH] testing: fix mypy issues in test_repr_args_not_truncated --- testing/code/test_excinfo.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index fefb3cdf2..ddd937a08 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -10,6 +10,7 @@ import re import sys import textwrap from typing import Any +from typing import cast from typing import TYPE_CHECKING import _pytest._code @@ -721,14 +722,15 @@ raise ValueError() p = FormattedExcinfo(funcargs=True, truncate_args=True) reprfuncargs = p.repr_args(entry) assert reprfuncargs is not None - assert len(reprfuncargs.args[0][1]) < 500 - assert "..." in reprfuncargs.args[0][1] + arg1 = cast(str, reprfuncargs.args[0][1]) + assert len(arg1) < 500 + assert "..." in arg1 # again without truncate p = FormattedExcinfo(funcargs=True, truncate_args=False) reprfuncargs = p.repr_args(entry) assert reprfuncargs is not None assert reprfuncargs.args[0] == ("m", repr("m" * 500)) - assert "..." not in reprfuncargs.args[0][1] + assert "..." not in cast(str, reprfuncargs.args[0][1]) def test_repr_tracebackentry_lines(self, importasmod) -> None: mod = importasmod(