Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase doctest coverage in sage/coding/linear_code.py to 100% #12893

Closed
benjaminfjones opened this issue May 1, 2012 · 10 comments
Closed

Increase doctest coverage in sage/coding/linear_code.py to 100% #12893

benjaminfjones opened this issue May 1, 2012 · 10 comments

Comments

@benjaminfjones
Copy link
Contributor

As the summary states. As of sage-5.0.beta14 coverage is:

linear_code.py
SCORE linear_code.py: 82% (52 of 63)

Missing documentation:
 * __init__(self, gen_mat):
 * _repr_(self):
 * ambient_space(self):
 * basis(self):
 * __contains__(self,v):
 * characteristic(self):
 * __cmp__(self, right):

Missing doctests:
 * bounds_minimum_distance(n, k, F):
 * sd_duursma_data(C, i):
 * sd_duursma_q(C,i,d0):
 * LinearCodeFromVectorSpace(self):

Possibly wrong (function name doesn't occur in doctests):
 * _magma_init_(self, magma):

Apply attachment: trac_12893_linear_code_doctests.patch to the Sage library.

Component: documentation

Keywords: linear code doctest coverage

Author: Benjamin Jones

Reviewer: William Stein

Merged: sage-5.1.beta0

Issue created by migration from https://trac.sagemath.org/ticket/12893

@benjaminfjones
Copy link
Contributor Author

Attachment: trac_12893_linear_code_doctests.patch.gz

increase doctest coverage to 100%, remove trailing whitespace, and fix bug in sd_duursma_q function

@benjaminfjones
Copy link
Contributor Author

comment:1

Note the bugfix in sd_duursma_q, the syntax T^2 was changed to T**2. This would have been discovered if doctests has been included with the code originally.

After the patch:

> mysage -coverage linear_code.py 
----------------------------------------------------------------------
linear_code.py
SCORE linear_code.py: 100% (63 of 63)
----------------------------------------------------------------------

> mysage -t linear_code.py 
sage -t  "devel/sage-test/sage/coding/linear_code.py"       
	 [18.9 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 18.9 seconds

@benjaminfjones

This comment has been minimized.

@williamstein
Copy link
Contributor

comment:4

Could you fix these errors (possibly not caused by you)?

wstein@sage:sage-5.0.beta15-boxen-x86_64-Linux$ ./sage -t --optional devel/sage/sage/coding/linear_code.py sage -t --optional "devel/sage/sage/coding/linear_code.py"  
**********************************************************************
File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/devel/sage/sage/coding/linear_code.py", line 1992:
    sage: C.permutation_automorphism_group(algorithm="gap")  # requires optional GAP package Guava
Exception raised:
    Traceback (most recent call last):
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_49[21]>", line 1, in <module>
        C.permutation_automorphism_group(algorithm="gap")  # requires optional GAP package Guava###line 1992:
    sage: C.permutation_automorphism_group(algorithm="gap")  # requires optional GAP package Guava
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/lib/python/site-packages/sage/misc/decorators.py", line 687, in wrapper
        return func(*args, **kwds)
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/lib/python/site-packages/sage/coding/linear_code.py", line 2033, in permutation_automorphism_group
        A = gap("MatrixAutomorphisms(matCwt)")
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/lib/python/site-packages/sage/interfaces/interface.py", line 198, in __call__
        return cls(self, x, name=name)
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/lib/python/site-packages/sage/interfaces/expect.py", line 1331, in __init__
        raise TypeError, x
    TypeError: Gap produced error output
    Error, no 1st choice method found for `MatrixAutomorphisms' on 1 arguments

       executing $sage24:=MatrixAutomorphisms(matCwt);;
**********************************************************************
File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/devel/sage/sage/coding/linear_code.py", line 1995:
    sage: C.permutation_automorphism_group(algorithm="gap")  # requires optional GAP package Guava
Exception raised:
    Traceback (most recent call last):
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_49[23]>", line 1, in <module>
        C.permutation_automorphism_group(algorithm="gap")  # requires optional GAP package Guava###line 1995:
    sage: C.permutation_automorphism_group(algorithm="gap")  # requires optional GAP package Guava
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/lib/python/site-packages/sage/misc/decorators.py", line 687, in wrapper
        return func(*args, **kwds)
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/lib/python/site-packages/sage/coding/linear_code.py", line 2033, in permutation_automorphism_group
        A = gap("MatrixAutomorphisms(matCwt)")
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/lib/python/site-packages/sage/interfaces/interface.py", line 198, in __call__
        return cls(self, x, name=name)
      File "/scratch/wstein/ref/sage-5.0.beta15-boxen-x86_64-Linux/local/lib/python/site-packages/sage/interfaces/expect.py", line 1331, in __init__
        raise TypeError, x
    TypeError: Gap produced error output
    Error, no 1st choice method found for `MatrixAutomorphisms' on 1 arguments

       executing $sage26:=MatrixAutomorphisms(matCwt);;
**********************************************************************
1 items had failures:
   2 of  25 in __main__.example_49
***Test Failed*** 2 failures.
For whitespace errors, see the file /home/wstein/.sage//tmp/linear_code_4858.py
         [14.8 s]
 
----------------------------------------------------------------------
The following tests failed:


        sage -t --optional "devel/sage/sage/coding/linear_code.py"
Total time for all tests: 14.9 seconds
(sage-sh) wstein@sage:sage-5.0.beta15-boxen-x86_64-Linux$ 

@benjaminfjones
Copy link
Contributor Author

comment:5

I can try.. the same problem occurs on vanilla sage-4.8 after installing the gap_packages optional spkg.

It looks like GAP is throwing an error when an empty matrix is passed to MatrixAutomorphisms. I'll look into it further. It seems like the weights either aren't being handled correctly or aren't being computed correctly in the algorithm=gap part of the code.

@williamstein
Copy link
Contributor

comment:6

I'll give this ticket a positive review. Fixing those other failures can be for another ticket.

@benjaminfjones
Copy link
Contributor Author

comment:7

Thanks, the algorithm=gap bug is now #12901.

@jdemeyer
Copy link

jdemeyer commented May 4, 2012

Reviewer: William Stein

@jdemeyer
Copy link

jdemeyer commented May 6, 2012

Merged: sage-5.1.beta0

@fchapoton

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants