[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
bf7b80c3f1
commit
5b4df5e295
|
@ -94,7 +94,9 @@ def safeformat(obj: object) -> str:
|
||||||
DEFAULT_REPR_MAX_SIZE = 240
|
DEFAULT_REPR_MAX_SIZE = 240
|
||||||
|
|
||||||
|
|
||||||
def saferepr(obj: object, maxsize: Optional[int] = DEFAULT_REPR_MAX_SIZE, use_ascii: bool = False) -> str:
|
def saferepr(
|
||||||
|
obj: object, maxsize: Optional[int] = DEFAULT_REPR_MAX_SIZE, use_ascii: bool = False
|
||||||
|
) -> str:
|
||||||
"""Return a size-limited safe repr-string for the given object.
|
"""Return a size-limited safe repr-string for the given object.
|
||||||
|
|
||||||
Failing __repr__ functions of user instances will be represented
|
Failing __repr__ functions of user instances will be represented
|
||||||
|
|
|
@ -157,11 +157,17 @@ def has_default_eq(
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def assertrepr_compare(config, op: str, left: Any, right: Any, use_ascii: bool=False) -> Optional[List[str]]:
|
def assertrepr_compare(
|
||||||
|
config, op: str, left: Any, right: Any, use_ascii: bool = False
|
||||||
|
) -> Optional[List[str]]:
|
||||||
"""Return specialised explanations for some operators/operands."""
|
"""Return specialised explanations for some operators/operands."""
|
||||||
verbose = config.getoption("verbose")
|
verbose = config.getoption("verbose")
|
||||||
|
|
||||||
use_ascii = isinstance(left, str) and isinstance(right, str) and normalize("NFD", left) == normalize("NFD", right)
|
use_ascii = (
|
||||||
|
isinstance(left, str)
|
||||||
|
and isinstance(right, str)
|
||||||
|
and normalize("NFD", left) == normalize("NFD", right)
|
||||||
|
)
|
||||||
|
|
||||||
if verbose > 1:
|
if verbose > 1:
|
||||||
left_repr = saferepr_unlimited(left, use_ascii=use_ascii)
|
left_repr = saferepr_unlimited(left, use_ascii=use_ascii)
|
||||||
|
|
|
@ -781,7 +781,11 @@ class TestAssert_reprcompare:
|
||||||
left = "hyv\xe4"
|
left = "hyv\xe4"
|
||||||
right = "hyva\u0308"
|
right = "hyva\u0308"
|
||||||
expl = callequal(left, right)
|
expl = callequal(left, right)
|
||||||
assert expl == ['"\'hyv\\\\xe4\'" == "\'hyva\\\\u0308\'"', f'- {str(right)}', f'+ {str(left)}']
|
assert expl == [
|
||||||
|
"\"'hyv\\\\xe4'\" == \"'hyva\\\\u0308'\"",
|
||||||
|
f"- {str(right)}",
|
||||||
|
f"+ {str(left)}",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class TestAssert_reprcompare_dataclass:
|
class TestAssert_reprcompare_dataclass:
|
||||||
|
|
Loading…
Reference in New Issue