sage -t --optional=... skips the normal tests?

38 views
Skip to first unread message

P Purkayastha

unread,
Jul 13, 2014, 7:52:32 AM7/13/14
to sage-...@googlegroups.com
I am trying to doctest the coding folder with the optional gap_packages. But it seems to skip the statements without the "# optional" statement. The result of it is that the optional tests are all failing. Here is an output:

...allations/sage-git [128] » sage -t --optional=gap_packages src/sage/coding
Running doctests with ID 2014-07-13-19-47-19-ba9f5690.
Doctesting 17 files.
sage
-t src/sage/coding/binary_code.pyx
   
[0 tests, 0.01 s]
sage
-t src/sage/coding/decoder.py
   
[0 tests, 0.00 s]
sage
-t src/sage/coding/codes_catalog.py
   
[0 tests, 0.00 s]
sage
-t src/sage/coding/code_constructions.py
   
[0 tests, 0.00 s]
sage
-t src/sage/coding/sd_codes.py
   
[0 tests, 0.00 s]
sage
-t src/sage/coding/all.py
   
[0 tests, 0.00 s]
sage
-t src/sage/coding/delsarte_bounds.py
   
[0 tests, 0.00 s]
sage
-t src/sage/coding/linear_code.py
**********************************************************************
File "src/sage/coding/linear_code.py", line 371, in sage.coding.linear_code.min_wt_vec_gap
Failed example:
    sage
.coding.linear_code.min_wt_vec_gap(Gstr,7,4,GF(2),algorithm="guava")    # optional - gap_packages (Guava package)
Exception raised:
   
Traceback (most recent call last):
     
File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 480, in _run
       
self.execute(example, compiled, test.globs)
     
File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 839, in execute
       
exec compiled in globs
     
File "<doctest sage.coding.linear_code.min_wt_vec_gap[0]>", line 1, in <module>
        sage
.coding.linear_code.min_wt_vec_gap(Gstr,Integer(7),Integer(4),GF(Integer(2)),algorithm="guava")    # optional - gap_packages (Guava package)
   
NameError: name 'Gstr' is not defined
**********************************************************************

This shouldn't fail because 'Gstr' is defined all right in the actual file:

    EXAMPLES::


        sage
: Gstr = "Z(2)*[[1,1,1,0,0,0,0], [1,0,0,1,1,0,0], [0,1,0,1,0,1,0], [1,1,0,1,0,0,1]]"
        sage
: sage.coding.linear_code.min_wt_vec_gap(Gstr,7,4,GF(2))
       
(0, 1, 0, 1, 0, 1, 0)


   
This output is different but still a minimum weight vector::


        sage
: sage.coding.linear_code.min_wt_vec_gap(Gstr,7,4,GF(2),algorithm="guava")    # optional - gap_packages (Guava package)
       
(0, 0, 1, 0, 1, 1, 0)

Also, note that the files preceding "linear_code.py" all report "0 tests", which doesn't make any sense.

Is there some other argument I must provide with --optional?

Volker Braun

unread,
Jul 13, 2014, 8:13:37 AM7/13/14
to sage-...@googlegroups.com
sage -t --optional=sage,gap_packages src/sage/coding

P Purkayastha

unread,
Jul 13, 2014, 8:09:17 PM7/13/14
to sage-...@googlegroups.com
Thanks. This worked.
> Traceback(most recent call last):
> File"/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py",line
> 480,in_run
> self.execute(example,compiled,test.globs)
> File"/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py",line
> 839,inexecute
> execcompiled inglobs
> File"<doctest sage.coding.linear_code.min_wt_vec_gap[0]>",line
> 1,in<module>
>
> sage.coding.linear_code.min_wt_vec_gap(Gstr,Integer(7),Integer(4),GF(Integer(2)),algorithm="guava")#
> optional - gap_packages (Guava package)
> NameError:name 'Gstr'isnotdefined
> **********************************************************************
> |
>
> This shouldn't fail because 'Gstr' is defined all right in the
> actual file:
>
> |
> EXAMPLES::
>
>
> sage:Gstr="Z(2)*[[1,1,1,0,0,0,0], [1,0,0,1,1,0,0],
> [0,1,0,1,0,1,0], [1,1,0,1,0,0,1]]"
> sage:sage.coding.linear_code.min_wt_vec_gap(Gstr,7,4,GF(2))
> (0,1,0,1,0,1,0)
>
>
> Thisoutput isdifferent but still a minimum weight vector::
>
>
>
> sage:sage.coding.linear_code.min_wt_vec_gap(Gstr,7,4,GF(2),algorithm="guava")#
> optional - gap_packages (Guava package)
> (0,0,1,0,1,1,0)
> |
>
> Also, note that the files preceding "linear_code.py" all report "0
> tests", which doesn't make any sense.
>
> Is there some other argument I must provide with --optional?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-devel" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-devel/qAI57GFh02k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-devel+...@googlegroups.com
> <mailto:sage-devel+...@googlegroups.com>.
> To post to this group, send email to sage-...@googlegroups.com
> <mailto:sage-...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.


John Cremona

unread,
Jul 14, 2014, 4:36:24 AM7/14/14
to SAGE devel
On 14 July 2014 01:09, P Purkayastha <ppu...@gmail.com> wrote:
> Thanks. This worked.

I have been caught out by this one too. When you put the --optional
flag on the command line it *only* runs lines with that flag, where
the flag "sage" exceptionally means to run the other doctest lines
too, the ones with no flag. I think the idea is that the optional
tests should form complete sets in themselves, so that testing one of
the sets (e.g. gap_packages) can be done much faster than testing the
whole library.

John
Reply all
Reply to author
Forward
0 new messages