From 6ee12b485f00dca24d17f882966ed293125901a5 Mon Sep 17 00:00:00 2001 From: Brock Date: Tue, 23 Mar 2021 13:08:30 -0700 Subject: [PATCH] TYP: testing.pyi --- pandas/_libs/testing.pyi | 8 ++++++++ pandas/_testing/asserters.py | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 pandas/_libs/testing.pyi diff --git a/pandas/_libs/testing.pyi b/pandas/_libs/testing.pyi new file mode 100644 index 0000000000000..ac0c772780c5c --- /dev/null +++ b/pandas/_libs/testing.pyi @@ -0,0 +1,8 @@ + + +def assert_dict_equal(a, b, compare_keys: bool = ...): ... + +def assert_almost_equal(a, b, + rtol: float = ..., atol: float = ..., + check_dtype: bool = ..., + obj=..., lobj=..., robj=..., index_values=...): ... diff --git a/pandas/_testing/asserters.py b/pandas/_testing/asserters.py index 2adc70438cce7..62205b9203bf0 100644 --- a/pandas/_testing/asserters.py +++ b/pandas/_testing/asserters.py @@ -154,6 +154,9 @@ def assert_almost_equal( else: obj = "Input" assert_class_equal(left, right, obj=obj) + + # if we have "equiv", this becomes True + check_dtype = bool(check_dtype) _testing.assert_almost_equal( left, right, check_dtype=check_dtype, rtol=rtol, atol=atol, **kwargs ) @@ -388,12 +391,15 @@ def _get_ilevel_values(index, level): msg = f"{obj} values are different ({np.round(diff, 5)} %)" raise_assert_detail(obj, msg, left, right) else: + + # if we have "equiv", this becomes True + exact_bool = bool(exact) _testing.assert_almost_equal( left.values, right.values, rtol=rtol, atol=atol, - check_dtype=exact, + check_dtype=exact_bool, obj=obj, lobj=left, robj=right,