diff --git a/changelog/5026.feature.rst b/changelog/5026.feature.rst new file mode 100644 index 000000000..aa0f3cbb3 --- /dev/null +++ b/changelog/5026.feature.rst @@ -0,0 +1 @@ +Assertion failure messages for sequences and dicts contain the number of different items now. diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index a62297075..b53646859 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -297,7 +297,7 @@ def _compare_eq_sequence(left, right, verbose=0): if len_diff > 0: dir_with_more = "Left" extra = saferepr(left[len_right]) - elif len_diff < 0: + else: len_diff = 0 - len_diff dir_with_more = "Right" extra = saferepr(right[len_left])