From 1b985f4a89646e775f83521d6b48ca1101f24e2f Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Sat, 1 Oct 2022 10:49:58 -0700 Subject: [PATCH 1/2] TST: Fail if parameterize set is empty --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 3e87d237170aa..7121ce1dc7c38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,6 +70,7 @@ disable = [ # sync minversion with pyproject.toml & install.rst minversion = "6.0" addopts = "--strict-data-files --strict-markers --strict-config --capture=no --durations=30 --junitxml=test-data.xml" +empty_parameter_set_mark = "fail_at_collect" xfail_strict = true testpaths = "pandas" doctest_optionflags = [ From 0e37342532fce76154b5f35ad165f654d39f52e5 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 3 Oct 2022 14:46:36 -0700 Subject: [PATCH 2/2] Refactor test --- pandas/tests/computation/test_eval.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index dbcf21f778cbf..6548422c5d2b7 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -77,11 +77,6 @@ def parser(request): return request.param -@pytest.fixture(params=list(_unary_math_ops) if NUMEXPR_INSTALLED else []) -def unary_fns_for_ne(request): - return request.param - - def _eval_single_bin(lhs, cmp1, rhs, engine): c = _binary_ops_dict[cmp1] if ENGINES[engine].has_neg_frac: @@ -1579,12 +1574,14 @@ def eval(self, *args, **kwargs): kwargs["level"] = kwargs.pop("level", 0) + 1 return pd.eval(*args, **kwargs) - def test_unary_functions(self, unary_fns_for_ne): + @pytest.mark.skipif( + not NUMEXPR_INSTALLED, reason="Unary ops only implemented for numexpr" + ) + @pytest.mark.parametrize("fn", _unary_math_ops) + def test_unary_functions(self, fn): df = DataFrame({"a": np.random.randn(10)}) a = df.a - fn = unary_fns_for_ne - expr = f"{fn}(a)" got = self.eval(expr) with np.errstate(all="ignore"):