#19939: Fix EuclideanRings.ParentMethods._test_quo_rem to use `not r.is_zero()`
rather than `r!=0`
-------------------------------------+-------------------------------------
       Reporter:  nthiery            |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-7.1
      Component:  categories         |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Nicolas M. Thiéry  |    Reviewers:  Samuel Lelièvre
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  
u/nthiery/fix_euclideanrings_parentmethods__test_quo_rem_to_use__not_r_is_zero____rather_than__r__0_|
  2d11e11975a16a496f16c8f56151a3932b45ed71
   Dependencies:  #19937             |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by nthiery):

 I indered pondered about this. I went for using `r.is_zero()` for
 style consistency with the nearby zero tests. But I don't have a
 strong opinion, and I am fine switching to `if r`. In that case, maybe
 the nearby zero tests should be changed accordingly for
 consistency. What do you think?

 By the way: I looked at the current tests failure. They are due to the
 default implementation of `quo_rem` for `Fields` which return a plain
 `0` for the remainder instead of the zero of the field:

     sage: K.<a> = NumberField(x^3 - 2); K
     Number Field in a with defining polynomial x^3 - 2
     sage: y = K.an_element()
     sage: y.parent()
     Number Field in a with defining polynomial x^3 - 2
     sage: q,r = y.quo_rem(y-1)
     sage: q,r
     sage: parent(q)               # OK
     Number Field in a with defining polynomial x^3 - 2
     sage: type(r)                 # GASP!!!
     <type 'int'>

 I am going to handle this right now by:

 1. Updating `EuclideanRings.ParentMethods._test_quo_rem` to test for this
 2. Fixing the default implementation of quo_rem

--
Ticket URL: <http://trac.sagemath.org/ticket/19939#comment:5>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to