[7.4.x] Fix error assertion handling in approx when None in dict comparison (#11180)

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
This commit is contained in:
github-actions[bot]
2023-07-08 18:37:35 +00:00
committed by GitHub
parent c71b5df734
commit 511adf85be
3 changed files with 31 additions and 12 deletions

View File

@@ -122,6 +122,23 @@ class TestApprox:
],
)
assert_approx_raises_regex(
{"a": 1.0, "b": None, "c": None},
{
"a": None,
"b": 1000.0,
"c": None,
},
[
r" comparison failed. Mismatched elements: 2 / 3:",
r" Max absolute difference: -inf",
r" Max relative difference: -inf",
r" Index \| Obtained\s+\| Expected\s+",
rf" a \| {SOME_FLOAT} \| None",
rf" b \| None\s+\| {SOME_FLOAT} ± {SOME_FLOAT}",
],
)
assert_approx_raises_regex(
[1.0, 2.0, 3.0, 4.0],
[1.0, 3.0, 3.0, 5.0],