[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
350ab6fb24
commit
2ae84c8494
|
@ -14,8 +14,8 @@ from typing import Sequence
|
||||||
import _pytest._code
|
import _pytest._code
|
||||||
from _pytest import outcomes
|
from _pytest import outcomes
|
||||||
from _pytest._io.saferepr import _pformat_dispatch
|
from _pytest._io.saferepr import _pformat_dispatch
|
||||||
from _pytest._io.saferepr import saferepr_unlimited
|
|
||||||
from _pytest._io.saferepr import saferepr
|
from _pytest._io.saferepr import saferepr
|
||||||
|
from _pytest._io.saferepr import saferepr_unlimited
|
||||||
from _pytest.config import Config
|
from _pytest.config import Config
|
||||||
|
|
||||||
# The _reprcompare attribute on the util module is used by the new assertion
|
# The _reprcompare attribute on the util module is used by the new assertion
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import pytest
|
import pytest
|
||||||
from _pytest._io.saferepr import _pformat_dispatch
|
from _pytest._io.saferepr import _pformat_dispatch
|
||||||
from _pytest._io.saferepr import DEFAULT_REPR_MAX_SIZE
|
from _pytest._io.saferepr import DEFAULT_REPR_MAX_SIZE
|
||||||
from _pytest._io.saferepr import saferepr, saferepr_unlimited
|
from _pytest._io.saferepr import saferepr
|
||||||
|
from _pytest._io.saferepr import saferepr_unlimited
|
||||||
|
|
||||||
|
|
||||||
def test_simple_repr():
|
def test_simple_repr():
|
||||||
|
@ -182,13 +183,13 @@ def test_broken_getattribute():
|
||||||
|
|
||||||
|
|
||||||
def test_saferepr_unlimited():
|
def test_saferepr_unlimited():
|
||||||
dict5 = {f'v{i}': i for i in range(5)}
|
dict5 = {f"v{i}": i for i in range(5)}
|
||||||
assert saferepr_unlimited(dict5) == "{'v0': 0, 'v1': 1, 'v2': 2, 'v3': 3, 'v4': 4}"
|
assert saferepr_unlimited(dict5) == "{'v0': 0, 'v1': 1, 'v2': 2, 'v3': 3, 'v4': 4}"
|
||||||
|
|
||||||
dict_long = {f'v{i}': i for i in range(1_000)}
|
dict_long = {f"v{i}": i for i in range(1_000)}
|
||||||
r = saferepr_unlimited(dict_long)
|
r = saferepr_unlimited(dict_long)
|
||||||
assert '...' not in r
|
assert "..." not in r
|
||||||
assert '\n' not in r
|
assert "\n" not in r
|
||||||
|
|
||||||
|
|
||||||
def test_saferepr_unlimited_exc():
|
def test_saferepr_unlimited_exc():
|
||||||
|
@ -197,5 +198,5 @@ def test_saferepr_unlimited_exc():
|
||||||
raise ValueError(42)
|
raise ValueError(42)
|
||||||
|
|
||||||
assert saferepr_unlimited(A()).startswith(
|
assert saferepr_unlimited(A()).startswith(
|
||||||
'<[ValueError(42) raised in repr()] A object at 0x'
|
"<[ValueError(42) raised in repr()] A object at 0x"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1698,9 +1698,9 @@ def test_assertion_location_with_coverage(pytester: Pytester) -> None:
|
||||||
|
|
||||||
|
|
||||||
def test_reprcompare_verbose_long() -> None:
|
def test_reprcompare_verbose_long() -> None:
|
||||||
a = {f'v{i}': i for i in range(11)}
|
a = {f"v{i}": i for i in range(11)}
|
||||||
b = a.copy()
|
b = a.copy()
|
||||||
b['v2'] += 10
|
b["v2"] += 10
|
||||||
lines = callop("==", a, b, verbose=2)
|
lines = callop("==", a, b, verbose=2)
|
||||||
assert lines[0] == (
|
assert lines[0] == (
|
||||||
"{'v0': 0, 'v1': 1, 'v2': 2, 'v3': 3, 'v4': 4, 'v5': 5, "
|
"{'v0': 0, 'v1': 1, 'v2': 2, 'v3': 3, 'v4': 4, 'v5': 5, "
|
||||||
|
|
Loading…
Reference in New Issue