Skip to content

Commit a424b8e

Browse files
committed
sage.rings.valuation.mapped_valuation_test: eliminate boilerplate
The one test in this file is easy to parameterize based on the index (an int) of a fixture supplied to it. This allows us to eliminate a lot of the boilerplate associated with fixture parameterizations.
1 parent 73f297f commit a424b8e

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

src/sage/rings/valuation/mapped_valuation_test.py

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,15 @@ def w():
1818
return v.extensions(L)
1919

2020

21-
@pytest.fixture
22-
def w0(w):
23-
return w[0]
24-
25-
26-
@pytest.fixture
27-
def w1(w):
28-
return w[1]
29-
30-
31-
# Use strings for the fixture names here, and then later convert them
32-
# to the actual fixture objects using request.getfixturevalue(). This
33-
# is a workaround for being unable to pass fixtures directly as
34-
# parameters:
35-
#
36-
# https://github.com/pytest-dev/pytest/issues/349
37-
#
38-
extensions = ( "w0", "w1" )
39-
40-
41-
@pytest.mark.parametrize("e", extensions)
42-
def test_finite_extension_from_limit_valuation(e, request):
21+
@pytest.mark.parametrize("idx", [0,1])
22+
def test_finite_extension_from_limit_valuation_w(w, idx):
4323
r"""
4424
Run the ``TestSuite()`` for two examples given in the
4525
``FiniteExtensionFromLimitValuation`` documentation.
4626
"""
4727
from sage.misc.sage_unittest import TestSuite
4828

49-
# Convert the string to a real fixture
50-
e = request.getfixturevalue(e)
51-
5229
# fewer max_runs, these are kind of slow
53-
TestSuite(e).run(verbose=True,
54-
raise_on_failure=True,
55-
max_runs=512)
30+
TestSuite(w[idx]).run(verbose=True,
31+
raise_on_failure=True,
32+
max_runs=512)

0 commit comments

Comments
 (0)