#6977: [with patch, needs work] Implement __len__ to add support for MuPAD 
objects
as Python containers
-------------------------+--------------------------------------------------
 Reporter:  nthiery      |       Owner:  nthiery          
     Type:  enhancement  |      Status:  assigned         
 Priority:  major        |   Milestone:  sage-4.1.2       
Component:  interfaces   |    Keywords:  MuPAD len        
 Reviewer:  Mike Hansen  |      Author:  Nicolas M. ThiƩry
   Merged:               |  
-------------------------+--------------------------------------------------

Comment(by mvngu):

 Any doctest involving MuPAD must be tagged as optional, otherwise one
 would get doctest failures. For example, for the patch
 `trac_6977_mupad_len.patch` the test
 {{{
 sage: len(mupad([1,2,3])) # indirect doctest
 }}}
 depends on having MuPAD one's local machine, so it should be written as
 {{{
 sage: len(mupad([1,2,3])) # optional indirect doctest
 }}}
 After applying the patch, I got these doctest failures:
 {{{
 sage -t -long devel/sage/sage/interfaces/mupad.py
 **********************************************************************
 File "/scratch/mvngu/release/sage-4.1.2.alpha2/devel/sage-
 main/sage/interfaces/mupad.py", line 599:
     sage: len(mupad([1,2,3])) # indirect doctest
 Exception raised:
     Traceback (most recent call last):
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1231, in run_one_test
         self.run_one_example(test, example, filename, compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/sagedoctest.py", line
 38, in run_one_example
         OrigDocTestRunner.run_one_example(self, test, example, filename,
 compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1172, in run_one_example
         compileflags, 1) in test.globs
       File "<doctest __main__.example_34[2]>", line 1, in <module>
         len(mupad([Integer(1),Integer(2),Integer(3)])) # indirect
 doctest###line 599:
     sage: len(mupad([1,2,3])) # indirect doctest
       File "/scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python
 /site-packages/sage/interfaces/expect.py", line 1044, in __call__
         raise TypeError, msg
     TypeError: Unable to start MuPAD because the command 'mupkern -P e -U
 SAGE=TRUE' failed.

     In order to use the MuPAD interface you need to have MuPAD installed
     and have a script in your PATH called "mupkern" that runs the
     command-line version of MuPAD.

       (1) You might have to buy MuPAD.

       (2) * LINUX: The mupkern script comes standard with your Mupad
 install.

           * APPLE OS X:
              ???

 **********************************************************************
 File "/scratch/mvngu/release/sage-4.1.2.alpha2/devel/sage-
 main/sage/interfaces/mupad.py", line 601:
     sage: type(len(mupad([1,2,3])))
 Exception raised:
     Traceback (most recent call last):
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1231, in run_one_test
         self.run_one_example(test, example, filename, compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/sagedoctest.py", line
 38, in run_one_example
         OrigDocTestRunner.run_one_example(self, test, example, filename,
 compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1172, in run_one_example
         compileflags, 1) in test.globs
       File "<doctest __main__.example_34[3]>", line 1, in <module>
         type(len(mupad([Integer(1),Integer(2),Integer(3)])))###line 601:
     sage: type(len(mupad([1,2,3])))
       File "/scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python
 /site-packages/sage/interfaces/expect.py", line 1044, in __call__
         raise TypeError, msg
     TypeError: Unable to start MuPAD because the command 'mupkern -P e -U
 SAGE=TRUE' failed.

     In order to use the MuPAD interface you need to have MuPAD installed
     and have a script in your PATH called "mupkern" that runs the
     command-line version of MuPAD.

       (1) You might have to buy MuPAD.

       (2) * LINUX: The mupkern script comes standard with your Mupad
 install.

           * APPLE OS X:
              ???

 **********************************************************************
 File "/scratch/mvngu/release/sage-4.1.2.alpha2/devel/sage-
 main/sage/interfaces/mupad.py", line 604:
     sage: len(mupad(4))
 Exception raised:
     Traceback (most recent call last):
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1231, in run_one_test
         self.run_one_example(test, example, filename, compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/sagedoctest.py", line
 38, in run_one_example
         OrigDocTestRunner.run_one_example(self, test, example, filename,
 compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1172, in run_one_example
         compileflags, 1) in test.globs
       File "<doctest __main__.example_34[4]>", line 1, in <module>
         len(mupad(Integer(4)))###line 604:
     sage: len(mupad(4))
       File "/scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python
 /site-packages/sage/interfaces/expect.py", line 1033, in __call__
         return self._coerce_from_special_method(x)
       File "/scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python
 /site-packages/sage/interfaces/expect.py", line 1059, in
 _coerce_from_special_method
         return self(x._interface_init_())
       File "/scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python
 /site-packages/sage/interfaces/expect.py", line 1031, in __call__
         return cls(self, x, name=name)
       File "/scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python
 /site-packages/sage/interfaces/expect.py", line 1447, in __init__
         raise TypeError, x
     TypeError: Unable to start MuPAD because the command 'mupkern -P e -U
 SAGE=TRUE' failed.

     In order to use the MuPAD interface you need to have MuPAD installed
     and have a script in your PATH called "mupkern" that runs the
     command-line version of MuPAD.

       (1) You might have to buy MuPAD.

       (2) * LINUX: The mupkern script comes standard with your Mupad
 install.

           * APPLE OS X:
              ???

 **********************************************************************
 File "/scratch/mvngu/release/sage-4.1.2.alpha2/devel/sage-
 main/sage/interfaces/mupad.py", line 610:
     sage: map(ZZ, list(mupad([1,2,3])))
 Exception raised:
     Traceback (most recent call last):
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1231, in run_one_test
         self.run_one_example(test, example, filename, compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/sagedoctest.py", line
 38, in run_one_example
         OrigDocTestRunner.run_one_example(self, test, example, filename,
 compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1172, in run_one_example
         compileflags, 1) in test.globs
       File "<doctest __main__.example_34[5]>", line 1, in <module>
         map(ZZ, list(mupad([Integer(1),Integer(2),Integer(3)])))###line
 610:
     sage: map(ZZ, list(mupad([1,2,3])))
       File "/scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python
 /site-packages/sage/interfaces/expect.py", line 1044, in __call__
         raise TypeError, msg
     TypeError: Unable to start MuPAD because the command 'mupkern -P e -U
 SAGE=TRUE' failed.

     In order to use the MuPAD interface you need to have MuPAD installed
     and have a script in your PATH called "mupkern" that runs the
     command-line version of MuPAD.

       (1) You might have to buy MuPAD.

       (2) * LINUX: The mupkern script comes standard with your Mupad
 install.

           * APPLE OS X:
              ???

 **********************************************************************
 File "/scratch/mvngu/release/sage-4.1.2.alpha2/devel/sage-
 main/sage/interfaces/mupad.py", line 613:
     sage: [int(x) for x in mupad([1,2,3]) ]
 Exception raised:
     Traceback (most recent call last):
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1231, in run_one_test
         self.run_one_example(test, example, filename, compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/sagedoctest.py", line
 38, in run_one_example
         OrigDocTestRunner.run_one_example(self, test, example, filename,
 compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1172, in run_one_example
         compileflags, 1) in test.globs
       File "<doctest __main__.example_34[6]>", line 1, in <module>
         [int(x) for x in mupad([Integer(1),Integer(2),Integer(3)])
 ]###line 613:
     sage: [int(x) for x in mupad([1,2,3]) ]
       File "/scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python
 /site-packages/sage/interfaces/expect.py", line 1044, in __call__
         raise TypeError, msg
     TypeError: Unable to start MuPAD because the command 'mupkern -P e -U
 SAGE=TRUE' failed.

     In order to use the MuPAD interface you need to have MuPAD installed
     and have a script in your PATH called "mupkern" that runs the
     command-line version of MuPAD.

       (1) You might have to buy MuPAD.

       (2) * LINUX: The mupkern script comes standard with your Mupad
 install.

           * APPLE OS X:
              ???

 **********************************************************************
 File "/scratch/mvngu/release/sage-4.1.2.alpha2/devel/sage-
 main/sage/interfaces/mupad.py", line 616:
     sage: [int(x) for x in mupad("{1,2,3,5}") ]
 Exception raised:
     Traceback (most recent call last):
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1231, in run_one_test
         self.run_one_example(test, example, filename, compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/sagedoctest.py", line
 38, in run_one_example
         OrigDocTestRunner.run_one_example(self, test, example, filename,
 compileflags)
       File
 "/scratch/mvngu/release/sage-4.1.2.alpha2/local/bin/ncadoctest.py", line
 1172, in run_one_example
         compileflags, 1) in test.globs
       File "<doctest __main__.example_34[7]>", line 1, in <module>
         [int(x) for x in mupad("{1,2,3,5}") ]###line 616:
     sage: [int(x) for x in mupad("{1,2,3,5}") ]
       File "/scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python
 /site-packages/sage/interfaces/expect.py", line 1031, in __call__
         return cls(self, x, name=name)
       File "/scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python
 /site-packages/sage/interfaces/expect.py", line 1447, in __init__
         raise TypeError, x
     TypeError: Unable to start MuPAD because the command 'mupkern -P e -U
 SAGE=TRUE' failed.

     In order to use the MuPAD interface you need to have MuPAD installed
     and have a script in your PATH called "mupkern" that runs the
     command-line version of MuPAD.

       (1) You might have to buy MuPAD.

       (2) * LINUX: The mupkern script comes standard with your Mupad
 install.

           * APPLE OS X:
              ???

 **********************************************************************
 1 items had failures:
    6 of   8 in __main__.example_34
 ***Test Failed*** 6 failures.
 For whitespace errors, see the file
 /home/mvngu/.sage//tmp/.doctest_mupad.py
          [2.0 s]
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6977#comment:4>
Sage <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to