Ticket #7965: sage-trac_7965.patch

File sage-trac_7965.patch, 1.1 KB (added by jdemeyer, 9 years ago)

Add a doctest with the example from the description.

  • sage/rings/integer.pyx

    # HG changeset patch
    # User Michael Orlitzky <michael@orlitzky.com>
    # Date 1326481026 18000
    # Node ID a585bb23c445ed2f59a928869a10f521456b2032
    # Parent  54da725b7cdd6aea343049ae5f8f9738b5e5a8cf
    add a doctest for quo_rem() over the rationals
    
    diff --git a/sage/rings/integer.pyx b/sage/rings/integer.pyx
    a b  
    28212821       
    28222822        INPUT:
    28232823       
    2824         -  ``other`` - the integer the divisor
     2824        -  ``other`` - the divisor
    28252825       
    28262826        OUTPUT:
    28272827       
    2828        
    28292828        -  ``q`` - the quotient of self/other
    28302829       
    28312830        -  ``r`` - the remainder of self/other
     
    28502849
    28512850            sage: 3.quo_rem(ZZ['x'].0)
    28522851            (0, 3)
     2852
     2853        TESTS:
     2854
     2855        The divisor can be rational as well, although the remainder
     2856        will always be zero (trac #7965)::
     2857
     2858            sage: 5.quo_rem(QQ(2))
     2859            (5/2, 0)
     2860            sage: 5.quo_rem(2/3)
     2861            (15/2, 0)
     2862
    28532863        """
    28542864        cdef Integer q = PY_NEW(Integer)
    28552865        cdef Integer r = PY_NEW(Integer)