From 0f965e57a23313b0020e1c9737380dbe18b6d088 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 5 Apr 2019 12:12:29 +0200 Subject: [PATCH] changelog, fix branch coverage --- changelog/5026.feature.rst | 1 + src/_pytest/assertion/util.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog/5026.feature.rst 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])