Skip to content

Commit

Permalink
Trac #23510: Fraction field of fixed modulus p-adic rings should have…
Browse files Browse the repository at this point in the history
… floating point type

Fraction field of fixed modulus p-adic rings should have floating point
type.

Currently the `change()` method requires that the type be specified, in
this case, but instances such as the check `R.fraction_field() is self`
occurring in _coerce_map_from_(self, R) in padic_extension_generic.pyc.

URL: https://trac.sagemath.org/23510
Reported by: bsinclai
Ticket author(s): David Roe
Reviewer(s): Adele Bourgeois, Julian Rüth
  • Loading branch information
Release Manager authored and vbraun committed Oct 13, 2017
2 parents f8b263f + 189ac2b commit 75daefe
Show file tree
Hide file tree
Showing 18 changed files with 519 additions and 167 deletions.
3 changes: 3 additions & 0 deletions src/doc/en/thematic_tutorials/coercion_and_categories.rst
Expand Up @@ -1552,6 +1552,7 @@ Here are the tests that form the test suite of quotient fields::
'_test_elements_eq_transitive',
'_test_elements_neq',
'_test_euclidean_degree',
'_test_fraction_field',
'_test_gcd_vs_xgcd',
'_test_one', '_test_prod',
'_test_quo_rem',
Expand Down Expand Up @@ -1606,6 +1607,7 @@ Let us see what tests are actually performed::
running ._test_elements_neq() . . . pass
running ._test_eq() . . . pass
running ._test_euclidean_degree() . . . pass
running ._test_fraction_field() . . . pass
running ._test_gcd_vs_xgcd() . . . pass
running ._test_new() . . . pass
running ._test_not_implemented_methods() . . . pass
Expand Down Expand Up @@ -1778,6 +1780,7 @@ interesting.
running ._test_elements_neq() . . . pass
running ._test_eq() . . . pass
running ._test_euclidean_degree() . . . pass
running ._test_fraction_field() . . . pass
running ._test_gcd_vs_xgcd() . . . pass
running ._test_new() . . . pass
running ._test_not_implemented_methods() . . . pass
Expand Down
26 changes: 26 additions & 0 deletions src/sage/categories/integral_domains.py
Expand Up @@ -107,5 +107,31 @@ def is_integral_domain(self):
"""
return True

def _test_fraction_field(self, **options):
r"""
Test that the fraction field, if it is implemented, works
correctly.
EXAMPLES::
sage: ZZ._test_fraction_field()
"""
tester = self._tester(**options)
try:
fraction_field = self.fraction_field()
except Exception:
# some integral domains do not implement fraction_field() yet
if self in Fields():
raise
return

for x in tester.some_elements():
# check that we can coerce into the fraction field
y = fraction_field.coerce(x)
# and convert back from it
z = self(x)
tester.assertEqual(x, z)

class ElementMethods:
pass
1 change: 1 addition & 0 deletions src/sage/rings/padics/CA_template.pxi
Expand Up @@ -1301,6 +1301,7 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism):
TESTS::
sage: TestSuite(f).run()
"""
def __init__(self, R, K):
"""
Expand Down
1 change: 1 addition & 0 deletions src/sage/rings/padics/CR_template.pxi
Expand Up @@ -2059,6 +2059,7 @@ cdef class pAdicCoercion_CR_frac_field(RingHomomorphism):
TESTS::
sage: TestSuite(f).run()
"""
def __init__(self, R, K):
"""
Expand Down

0 comments on commit 75daefe

Please sign in to comment.