Ticket #12893 (closed enhancement: fixed)
Increase doctest coverage in sage/coding/linear_code.py to 100%
| Reported by: | benjaminfjones | Owned by: | mvngu |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-5.1 |
| Component: | documentation | Keywords: | linear code doctest coverage |
| Cc: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | William Stein |
| Authors: | Benjamin Jones | Merged in: | sage-5.1.beta0 |
| Dependencies: | Stopgaps: |
Description (last modified by benjaminfjones) (diff)
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 trac_12893_linear_code_doctests.patch to the Sage library.
Attachments
Change History
Changed 13 months ago by benjaminfjones
-
attachment
trac_12893_linear_code_doctests.patch
added
comment:1 Changed 13 months ago by benjaminfjones
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
comment:4 Changed 13 months ago by was
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$
comment:5 Changed 13 months ago by benjaminfjones
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.

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