Ticket #12154: 12154-magma-doctest.patch

File 12154-magma-doctest.patch, 5.5 KB (added by mstreng, 9 years ago)
  • sage/interfaces/magma.py

    # HG changeset patch
    # User Marco Streng <marco.streng@gmail.com>
    # Date 1323895611 0
    # Node ID f525035285cc09203db7aaf8c106be23a1cdf118
    # Parent  b72663c760492cc8c360d328a6d370c8f88d2069
    fix magma doctest failures
    
    diff --git a/sage/interfaces/magma.py b/sage/interfaces/magma.py
    a b  
    19511951
    19521952        Multivariate polynomials::
    19531953
    1954             sage: R.<x,y,z> = QQ[]                   # optional - magma
    1955             sage: f = x^2+3*y                        # optional - magma
     1954            sage: R.<x,y,z> = QQ[]
     1955            sage: f = x^2+3*y
    19561956            sage: g = magma(f).sage(); g             # optional - magma
    19571957            x^2 + 3*y
    19581958            sage: parent(f) == parent(g)             # optional - magma
     
    19601960
    19611961        Number fields and their elements::
    19621962
     1963            sage: R.<x> = QQ[]
    19631964            sage: L.<alpha> = NumberField(x^3+2*x+2)
    19641965            sage: K = magma(L)                       # optional - magma
    19651966            sage: K.sage()                           # optional - magma
     
    19821983            sage: magma(b)                       # optional - magma
    19831984            Traceback (most recent call last):   
    19841985            ...       
    1985             TypeError: Error evaluating Magma code.
    1986             ...
     1986            NotImplementedError: Cannot convert relative number field elements to Magma
    19871987
    19881988        Sage does not have absolute number fields defined by
    19891989        two polynomials, like Magma does. They are converted
  • sage/rings/number_field/number_field_element.pyx

    diff --git a/sage/rings/number_field/number_field_element.pyx b/sage/rings/number_field/number_field_element.pyx
    a b  
    37063706        R = K.base_field()[var]
    37073707        return R(self.list())
    37083708
     3709    def _magma_init_(self, magma):
     3710        """
     3711        This function is not implemented for relative number field elements.
     3712
     3713        Given a Magma interpreter ``magma``, return a string that evaluates
     3714        in that interpreter to the Magma object corresponding to self.
     3715        This funtion may call the magma interpreter when it runs.
     3716
     3717        INPUT:
     3718
     3719        - ``magma`` -- a Magma interface
     3720
     3721        OUTPUT:
     3722
     3723        - string
     3724
     3725        EXAMPLES::
     3726
     3727            sage: R.<x> = QQ[]
     3728            sage: K.<a> = NumberField(x^2+3)
     3729            sage: S.<y> = K[]
     3730            sage: L.<b> = NumberField(y^2-2)
     3731            sage: b._magma_init_(magma)        # optional - magma
     3732            Traceback (most recent call last):
     3733            ...
     3734            NotImplementedError: Cannot convert relative number field elements to Magma
     3735            sage: magma.eval('b:=3')           # optional - magma
     3736            ''
     3737            sage: magma(b)                     # optional - magma
     3738            Traceback (most recent call last):
     3739            ...
     3740            NotImplementedError: Cannot convert relative number field elements to Magma
     3741        """
     3742        raise NotImplementedError, "Cannot convert relative number field elements to Magma"
     3743
    37093744    def _pari_(self, var='x'):
    37103745        """
    37113746        Return PARI C-library object corresponding to self.
  • sage/rings/polynomial/multi_polynomial.pyx

    diff --git a/sage/rings/polynomial/multi_polynomial.pyx b/sage/rings/polynomial/multi_polynomial.pyx
    a b  
    805805
    806806            sage: R.<x,y> = QQ[]; S.<z,w> = R[]; f = (2/3)*x^3*z + w^2 + 5
    807807            sage: f._magma_init_(magma)               # optional - magma
    808             '_sage_[...]!((_sage_[...]!((1)*1))*_sage_[...]^2+(_sage_[...]!((2/3)*_sage_[...]^3))*_sage_[...]+(_sage_[...]!((5)*1))*1)'
     808            '_sage_[...]!((_sage_[...]!((1/1)*1))*_sage_[...]^2+(_sage_[...]!((2/3)*_sage_[...]^3))*_sage_[...]+(_sage_[...]!((5/1)*1))*1)'
    809809            sage: magma(f)                            # optional - magma
    810810            w^2 + 2/3*x^3*z + 5
    811811        """
  • sage/schemes/elliptic_curves/ell_generic.py

    diff --git a/sage/schemes/elliptic_curves/ell_generic.py b/sage/schemes/elliptic_curves/ell_generic.py
    a b  
    336336       
    337337            sage: E = EllipticCurve(QQ,[1,1])
    338338            sage: E._magma_init_(magma)                          # optional - magma
    339             'EllipticCurve([_sage_ref...|0,0,0,1,1])'
     339            'EllipticCurve([_sage_ref...|0/1,0/1,0/1,1/1,1/1])'
    340340            sage: E =  EllipticCurve(GF(41),[2,5])               # optional - magma
    341341            sage: E._magma_init_(magma)                          # optional - magma
    342342            'EllipticCurve([_sage_ref...|GF(41)!0,GF(41)!0,GF(41)!0,GF(41)!2,GF(41)!5])'
  • sage/schemes/plane_conics/con_field.py

    diff --git a/sage/schemes/plane_conics/con_field.py b/sage/schemes/plane_conics/con_field.py
    a b  
    604604       
    605605            sage: C = Conic(QQ, [1,2,3])
    606606            sage: C._magma_init_(magma)                          # optional - magma
    607             'Conic([_sage_ref1|1,2,3,0,0,0])'
    608             sage: C = Conic(GF(41), [-1,2,5])                    # optional - magma
     607            'Conic([_sage_ref...|1/1,2/1,3/1,0/1,0/1,0/1])'
     608            sage: C = Conic(GF(41), [-1,2,5])
    609609            sage: C._magma_init_(magma)                          # optional - magma
    610             'Conic([_sage_ref2|GF(41)!40,GF(41)!2,GF(41)!5,GF(41)!0,GF(41)!0,GF(41)!0])'
     610            'Conic([_sage_ref...|GF(41)!40,GF(41)!2,GF(41)!5,GF(41)!0,GF(41)!0,GF(41)!0])'
    611611            sage: F.<a> = GF(25)
    612612            sage: C = Conic([3,0,1,4,a,2])
    613613            sage: C