#19388: Write better doctest for parent.register_embedding
---------------------------+----------------------------
   Reporter:  nbruin       |            Owner:
       Type:  enhancement  |           Status:  new
   Priority:  major        |        Milestone:  sage-6.9
  Component:  misc         |         Keywords:
  Merged in:               |          Authors:
  Reviewers:               |  Report Upstream:  N/A
Work issues:               |           Branch:
     Commit:               |     Dependencies:
   Stopgaps:               |
---------------------------+----------------------------
 One of the current doctests on parent.register_embedding doesn't actually
 do what it should:
 {{{
            sage: x = QQ['x'].0
             sage: t = abs(ZZ.random_element(10^6))
             sage: K = NumberField(x^2 + 2*3*7*11, "a"+str(t))
             sage: a = K.gen()
             sage: K_into_MS = K.hom([a.matrix()])
             sage: K._unset_coercions_used()
             sage: K.register_embedding(K_into_MS)
             sage: L = NumberField(x^2 + 2*3*7*11*19*31,
 "b"+str(abs(ZZ.random_element(10^6))))
             sage: b = L.gen()
             sage: L_into_MS = L.hom([b.matrix()])
             sage: L._unset_coercions_used()
             sage: L.register_embedding(L_into_MS)
             sage: a * b.matrix()
             [this shouldn't test a registered embedding at all]
 }}}
 The problem here is that there is an "action" defined of `K` on
 `parent(b.matrix())` (namely, scalar multiplication on the base changed
 matrix) and actions are supposed to be discovered before coercions are, as
 documented on, e.g. `get_coercion_model().bin_op`. Previously, action
 discovery failed with an embedding map that produces unhashable elements,
 so the test above would use the registered embedding due to a covered up
 unexpected error. So the test only accidentally had anything to do with
 the registered embedding. With #19016 this is no longer the case. Can we
 replace this test with something more sensible? (also, note that anything
 calling `_unset_coercions_used` is a hack).

--
Ticket URL: <http://trac.sagemath.org/ticket/19388>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to