Ticket #4240 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

[with patch; positive review] magma -- increase doctest coverage of magma.py (all exported methods)

Reported by: was Owned by: was
Priority: major Milestone: sage-3.1.3
Component: interfaces Keywords:
Cc: GeorgSWeber Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

Right now the doctest coverage of devel/sage/sage/interfaces/magma.py is a pitiful 17%. Increase this to 100%. This will involving adding about 59 doctests and docstrings. See also #4231, which adds two docstrings/doctests.

Attachments

trac-4240.patch Download (16.4 KB) - added by was 5 years ago.
trac-4240-part2.patch Download (13.1 KB) - added by was 5 years ago.
coverage up to 69% -- all non underscore methods are now documented.
trac-4240-part3.patch Download (8.7 KB) - added by was 5 years ago.
insert all needed # optional's

Change History

comment:1 Changed 5 years ago by was

  • Status changed from new to assigned

Changed 5 years ago by was

comment:2 Changed 5 years ago by was

  • Summary changed from magma -- increase doctest coverage of magma.py from current 17% to 100%. to [with patch; not ready for review] magma -- increase doctest coverage of magma.py from current 17% to 100%.

comment:3 Changed 5 years ago by GeorgSWeber

  • Cc GeorgSWeber added

Changed 5 years ago by was

coverage up to 69% -- all non underscore methods are now documented.

Changed 5 years ago by was

insert all needed # optional's

comment:4 Changed 5 years ago by was

  • Summary changed from [with patch; not ready for review] magma -- increase doctest coverage of magma.py from current 17% to 100%. to [with patch; needs review] magma -- increase doctest coverage of magma.py (all exported methods)

comment:5 Changed 5 years ago by GeorgSWeber

  • Summary changed from [with patch; needs review] magma -- increase doctest coverage of magma.py (all exported methods) to [with patch; needs work] magma -- increase doctest coverage of magma.py (all exported methods)

Hi,

several issues. On the one hand, the first patch does not apply cleanly against 3.1.3 alpha series, since the hunk in gap.py does not fit (the "prompt" funtion to be removed did get a doctest, so the automatism breaks). More severely, there are invalid absolute paths in beginning with "/home/wstein/", specific to your local install, see what I get:

sage -t -long devel/sage-main/sage/interfaces/magma.py      **********************************************************************
File "/Users/georgweber/Public/sage/sage-3.1.3.alpha1/tmp/magma.py", line 598:
    sage: magma.attach_spec('%s/data/extcode/magma/spec2'%SAGE_ROOT)
Expected:
    Traceback (most recent call last):
    ...
    RuntimeError: Can't open package spec file /home/wstein/sage/data/extcode/magma/spec2 for reading (No such file or directory)
Got:
    Traceback (most recent call last):
      File "/Users/georgweber/Public/sage/sage-3.1.3.alpha1/local/lib/python2.5/doctest.py", line 1228, in __run
        compileflags, 1) in test.globs
      File "<doctest __main__.example_18[3]>", line 1, in <module>
        magma.attach_spec('%s/data/extcode/magma/spec2'%SAGE_ROOT)###line 598:
    sage: magma.attach_spec('%s/data/extcode/magma/spec2'%SAGE_ROOT)
      File "/Users/georgweber/Public/sage/sage-3.1.3.alpha1/local/lib/python2.5/site-packages/sage/interfaces/magma.py", line 605, in attach_spec
        raise RuntimeError, s.strip()
    RuntimeError: Can't open package spec file /Users/georgweber/Public/sage/sage-3.1.3.alpha1/data/extcode/magma/spec2 for reading (No such file or directory)
**********************************************************************
File "/Users/georgweber/Public/sage/sage-3.1.3.alpha1/tmp/magma.py", line 626:
    sage: print magma.load(SAGE_TMP + 'a.m')
Expected:
    Loading "/home/wstein/.sage//temp/one/.../a.m"
    hi
Got:
    Loading "/Users/georgweber/.sage//temp/susanne_webers_computer.local/602/a.m"
    hi
**********************************************************************
File "/Users/georgweber/Public/sage/sage-3.1.3.alpha1/tmp/magma.py", line 930:
    sage: magma.get_verbose("Groebner")
Expected:
    2
Got:
    0
**********************************************************************
File "/Users/georgweber/Public/sage/sage-3.1.3.alpha1/tmp/magma.py", line 948:
    sage: magma.GetVerbose("Groebner")
Expected:
    2
Got:
    0
**********************************************************************
4 items had failures:
   1 of   4 in __main__.example_18
   1 of   5 in __main__.example_19
   1 of   3 in __main__.example_27
   1 of   3 in __main__.example_28
***Test Failed*** 4 failures.
For whitespace errors, see the file /Users/georgweber/Public/sage/sage-3.1.3.alpha1/tmp/.doctest_magma.py
         [34.6 s]
exit code: 1024
 
----------------------------------------------------------------------
The following tests failed:


        sage -t -long devel/sage-main/sage/interfaces/magma.py
Total time for all tests: 34.6 seconds

The path issues should go away with some triple dots.

However, I have no idea yet what that last "Groebner" issue is (Expected: 2; Got: 0).

My Magma install says: "Magma V2.14-9", what does yours say?

Cheers, gsw

comment:6 Changed 5 years ago by GeorgSWeber

Ah,

we try to load a package, that can't be found. This does not go away just using triple dots in paths, instead some environment variable magic has to be used, but might explain the Groebner thing.

comment:7 Changed 5 years ago by was

not apply cleanly against 3.1.3 alpha

It's against 3.1.2.

Regarding the Groebner output, I think you didn't apply all the patches, since you have

sage: magma.get_verbose("Groebner")

in your log above, but the input line should be

sage: magma.get_verbose("Groebner")        # optional

In particular, you are doing

        sage -t -long devel/sage-main/sage/interfaces/magma.py

which with the third patch above should essentially do almost nothing, since you forgot to put --optional.

Regarding

we try to load a package, that can't be found. This does not go away just using triple dots in paths, instead some environment variable magic has to be used, but might explain the Groebner thing.

It is unrelated to Groebner. This will go away by putting in some ...'s.

comment:8 Changed 5 years ago by mabshoff

  • Summary changed from [with patch; needs work] magma -- increase doctest coverage of magma.py (all exported methods) to [with patch; positive review] magma -- increase doctest coverage of magma.py (all exported methods)

I fixed all the problems and a trivial reviewer patch is coming up. I did delete two hunks from the part3 patch since it contained fixes already done independently due to a previous patch. Tests pass with and without optional except two failures due to using Magma 2.13 instead of 2.14 on the test machine, but I can live with that:

sage -t -long -optional devel/sage/sage/interfaces/magma.py 
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.rc0/tmp/magma.py", line 90:
    sage: print M2
Expected:
    Space of modular forms on Gamma_1(5) with character $.1, weight 2, and dimension 2 over Integer Ring.
Got:
    Space of modular forms on Gamma_1(5) with character all conjugates of [$.1], weight 2, and dimension 2 over Integer Ring.
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.rc0/tmp/magma.py", line 92:
    sage: print M2.Basis()   # note -- this has been changed to be *wrong* as below in Magma 2.14!!
Expected:
    [
    1 + 10*q^2 + 20*q^3 + 20*q^5 + 60*q^7 + 50*q^8 + 30*q^10 + O(q^12),
    q + q^2 + 2*q^3 + 3*q^4 + 5*q^5 + 2*q^6 + 6*q^7 + 5*q^8 + 7*q^9 + 5*q^10 + 12*q^11 + O(q^12)
    ]
Got:
    [
    1 + 10*q^2 + 20*q^3 + 20*q^5 + 60*q^7 + O(q^8),
    q + q^2 + 2*q^3 + 3*q^4 + 5*q^5 + 2*q^6 + 6*q^7 + O(q^8)
    ]
**********************************************************************

comment:9 Changed 5 years ago by mabshoff

  • Status changed from assigned to closed
  • Resolution set to fixed

Merged in Sage 3.1.3.rc0

Note: See TracTickets for help on using tickets.