|
| 1 | +import pytest |
| 2 | + |
| 3 | +# sage.misc.sage_unittest.TestSuite imports are local to avoid |
| 4 | +# pytest warnings. |
| 5 | +from sage.rings.finite_rings.finite_field_constructor import FiniteField |
| 6 | +from sage.rings.function_field.constructor import FunctionField |
| 7 | +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing |
| 8 | +from sage.rings.rational_field import QQ |
| 9 | + |
| 10 | +class TestFunctionField: |
| 11 | + r""" |
| 12 | + Run the long/slow TestSuite() methods on some function fields |
| 13 | + that are constructed in the documentation. These used to be run in |
| 14 | + a ``TESTS::`` block, but they are more appropriate here. |
| 15 | + """ |
| 16 | + def test_function_field_S_M_N_testsuite(self): |
| 17 | + from sage.misc.sage_unittest import TestSuite |
| 18 | + |
| 19 | + K = FunctionField(FiniteField(5**2,'a'), 'x') |
| 20 | + x = K.gen() |
| 21 | + R = PolynomialRing(K, 'y') |
| 22 | + y = R.gen() |
| 23 | + L = K.extension(y**3 - (x**3 + 2*x*y + 1/x)) |
| 24 | + S = PolynomialRing(L, 't') |
| 25 | + t = S.gen() |
| 26 | + M = L.extension(t**2 - x*y) |
| 27 | + N = FunctionField(K, 'u') |
| 28 | + TestSuite(S).run(verbose=True, raise_on_failure=True, max_runs=8) |
| 29 | + TestSuite(M).run(verbose=True, raise_on_failure=True, max_runs=1) |
| 30 | + TestSuite(N).run(verbose=True, raise_on_failure=True, max_runs=1) |
| 31 | + |
| 32 | + # The test suites for K,L,O were inadvertently made to be over |
| 33 | + # QQbar in commit 5f162a448cb708fed40bebc1345fd656f918aed3. We use |
| 34 | + # the old, faster definitions over QQ. |
| 35 | + def test_function_field_K_L_O_testsuite(self): |
| 36 | + from sage.misc.sage_unittest import TestSuite |
| 37 | + |
| 38 | + K = FunctionField(QQ, 'x'); |
| 39 | + x = K.gen() |
| 40 | + Y = PolynomialRing(K, 'Y').gen() |
| 41 | + L = K.extension(Y**2 + Y + x + 1/x, 'y') |
| 42 | + O = L.maximal_order() |
| 43 | + TestSuite(K).run(verbose=True, raise_on_failure=True, max_runs=16) |
| 44 | + TestSuite(L).run(verbose=True, raise_on_failure=True, max_runs=2) |
| 45 | + TestSuite(O).run(verbose=True, raise_on_failure=True) |
| 46 | + |
| 47 | + def test_function_field_R_testsuite(self): |
| 48 | + from sage.misc.sage_unittest import TestSuite |
| 49 | + |
| 50 | + F = FunctionField(QQ, 'x') |
| 51 | + R = PolynomialRing(F, 'Y') |
| 52 | + TestSuite(R).run(verbose=True, raise_on_failure=True) |
| 53 | + |
| 54 | + def test_function_field_J_testsuite(self): |
| 55 | + from sage.misc.sage_unittest import TestSuite |
| 56 | + |
| 57 | + J = FunctionField(FiniteField(5), 'x') |
| 58 | + TestSuite(J).run(verbose=True, raise_on_failure=True) |
0 commit comments