testing: fix mypy issues in test_repr_args_not_truncated

This commit is contained in:
Michael Vogt 2024-06-03 10:22:57 +02:00
parent 1f19489e12
commit d4ed4bf02c
1 changed files with 5 additions and 3 deletions

View File

@ -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(