From cc04f06a4f97d24a56243237fcaa4c4f7c75ed1b Mon Sep 17 00:00:00 2001 From: Avinash Pancham Date: Sat, 24 Oct 2020 15:55:30 +0200 Subject: [PATCH 1/3] TST: Update unreliable num precision component of test_binary_arith_ops (GH37328) --- pandas/tests/computation/test_eval.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index 4c670e56613ed..5c4fca65b28ea 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -301,7 +301,7 @@ def check_alignment(self, result, nlhs, ghs, op): # direct numpy comparison expected = self.ne.evaluate(f"nlhs {op} ghs") - tm.assert_numpy_array_equal(result.values, expected) + tm.assert_almost_equal(result.values, expected, atol=1e-14, rtol=1e-15) # modulus, pow, and floor division require special casing From d6f3c1a6646a1226664077bf89f2baba542daf1a Mon Sep 17 00:00:00 2001 From: Avinash Pancham Date: Mon, 26 Oct 2020 23:17:48 +0100 Subject: [PATCH 2/3] Remove tolerances to be in line with other usages of assert_almost_equal --- pandas/tests/computation/test_eval.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index 5c4fca65b28ea..6b14d47907f11 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -298,10 +298,9 @@ def check_alignment(self, result, nlhs, ghs, op): # TypeError, AttributeError: series or frame with scalar align pass else: - # direct numpy comparison expected = self.ne.evaluate(f"nlhs {op} ghs") - tm.assert_almost_equal(result.values, expected, atol=1e-14, rtol=1e-15) + tm.assert_almost_equal(result.values, expected) # modulus, pow, and floor division require special casing From 77349992b10337b73481df2bf4ad4e80ed319fb4 Mon Sep 17 00:00:00 2001 From: Avinash Pancham Date: Wed, 28 Oct 2020 11:29:37 +0100 Subject: [PATCH 3/3] Add background on update of tests --- pandas/tests/computation/test_eval.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index 2d92d194df7eb..f106d44dfca7f 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -300,6 +300,10 @@ def check_alignment(self, result, nlhs, ghs, op): else: # direct numpy comparison expected = self.ne.evaluate(f"nlhs {op} ghs") + # Update assert statement due to unreliable numerical + # precision component (GH37328) + # TODO: update testing code so that assert_almost_equal statement + # can be replaced again by the assert_numpy_array_equal statement tm.assert_almost_equal(result.values, expected) # modulus, pow, and floor division require special casing