Skip to content

Commit 5913cd2

Browse files
committed
assertion/util: remove unhelpful type_fns indirection
It doesn't serve any purpose that I am able to discern.
1 parent 0cd190f commit 5913cd2

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/_pytest/assertion/util.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from typing import Mapping
1010
from typing import Optional
1111
from typing import Sequence
12-
from typing import Tuple
1312

1413
import _pytest._code
1514
from _pytest import outcomes
@@ -179,8 +178,7 @@ def _compare_eq_any(left: Any, right: Any, verbose: int = 0) -> List[str]:
179178
elif isdict(left) and isdict(right):
180179
explanation = _compare_eq_dict(left, right, verbose)
181180
elif type(left) == type(right) and (isdatacls(left) or isattrs(left)):
182-
type_fn = (isdatacls, isattrs)
183-
explanation = _compare_eq_cls(left, right, verbose, type_fn)
181+
explanation = _compare_eq_cls(left, right, verbose)
184182
elif verbose > 0:
185183
explanation = _compare_eq_verbose(left, right)
186184
if isiterable(left) and isiterable(right):
@@ -403,13 +401,7 @@ def _compare_eq_dict(
403401
return explanation
404402

405403

406-
def _compare_eq_cls(
407-
left: Any,
408-
right: Any,
409-
verbose: int,
410-
type_fns: Tuple[Callable[[Any], bool], Callable[[Any], bool]],
411-
) -> List[str]:
412-
isdatacls, isattrs = type_fns
404+
def _compare_eq_cls(left: Any, right: Any, verbose: int) -> List[str]:
413405
if isdatacls(left):
414406
all_fields = left.__dataclass_fields__
415407
fields_to_check = [field for field, info in all_fields.items() if info.compare]

0 commit comments

Comments
 (0)