Opened 3 years ago
Closed 3 years ago
#27821 closed defect (fixed)
covering_design.py & design_catalog.py: Fix AttributeError
Reported by: | vklein | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.8 |
Component: | combinatorial designs | Keywords: | thursdaysbdx |
Cc: | slabbe, slelievre | Merged in: | |
Authors: | Vincent Klein | Reviewers: | Sébastien Labbé |
Report Upstream: | N/A | Work issues: | |
Branch: | 138870c (Commits, GitHub, GitLab) | Commit: | 138870cddda3f3a3f4aaa0ad2cc5a0de974a1750 |
Dependencies: | Stopgaps: |
Description (last modified by )
- Fix the following bug.
sage: C = designs.best_known_covering_design_from_LJCR(7, 3, 2) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-a3d9f9e592f1> in <module>() ----> 1 C = designs.best_known_covering_design_from_LJCR(Integer(7), Integer(3), Integer(2)) /home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/combinat/designs/covering_design.pyc in best_known_covering_design_www(v, k, t, verbose) 525 if verbose: 526 print("Looking up the bounds at %s" % url) --> 527 with urlopen(url) as f: 528 s = bytes_to_str(f.read()) 529 if 'covering not in database' in s: # not found AttributeError: addinfourl instance has no attribute '__exit__'
Found by Sebastien Labbé see #26592
The root cause is that the object returned by urlopen
doesn't have an __exit__
method in python2 and therefore it can not be used with a with ... as ...
syntax.
- Fix a doctest error in design_catalog.py:
sage -t --long src/sage/combinat/designs/design_catalog.py ********************************************************************** File "src/sage/combinat/designs/design_catalog.py", line 23, in sage.combinat.designs.design_catalog Failed example: C # optional - internet Expected: (7,3,2)-covering design of size 7 Lower bound: 7 Method: lex covering Submitted on: 1996-12-01 00:00:00 Got: (7, 3, 2)-covering design of size 7 Lower bound: 7 Method: lex covering Submitted on: 1996-12-01 00:00:00 **********************************************************************
Change History (13)
comment:1 Changed 3 years ago by
- Summary changed from convering_design.py : Fix AttributeError to covering_design.py : Fix AttributeError
comment:2 Changed 3 years ago by
- Description modified (diff)
comment:3 Changed 3 years ago by
- Description modified (diff)
comment:4 follow-up: ↓ 6 Changed 3 years ago by
comment:5 Changed 3 years ago by
- Branch set to u/vklein/27821
comment:6 in reply to: ↑ 4 Changed 3 years ago by
- Commit set to 1e93e496d263032fa34b4fba2be6931fb741faf5
comment:7 Changed 3 years ago by
- Status changed from new to needs_review
comment:8 Changed 3 years ago by
- Status changed from needs_review to needs_work
As mentionned here, two files were having the same issue. We are almost there.
There is still one small issue:
$ sage -tp --long --optional=sage,optional,external src/sage/combinat/designs/covering_design.py src/sage/combinat/designs/design_catalog.py
gives
too many failed tests, not using stored timings Running doctests with ID 2019-05-13-17-17-32-23591643. Git branch: 27821 Using --optional=4ti2,bliss,cbc,ccache,cmake,cryptominisat,dot2tex,e_antic,external,glucose,latte_int,lidia,lrslib,memlimit,mpir,ninja_build,normaliz,notedown,pandoc_attributes,pycosat,pynormaliz,python2,qhull,rst2ipynb,sage,topcom External software to be detected: cplex,ffmpeg,graphviz,gurobi,imagemagick,internet,latex,macaulay2,magma,maple,mathematica,matlab,octave,pandoc,scilab Doctesting 2 files using 8 threads. sage -t --long src/sage/combinat/designs/design_catalog.py ********************************************************************** File "src/sage/combinat/designs/design_catalog.py", line 23, in sage.combinat.designs.design_catalog Failed example: C # optional - internet Expected: (7,3,2)-covering design of size 7 Lower bound: 7 Method: lex covering Submitted on: 1996-12-01 00:00:00 Got: (7, 3, 2)-covering design of size 7 Lower bound: 7 Method: lex covering Submitted on: 1996-12-01 00:00:00 ********************************************************************** 1 item had failures: 1 of 5 in sage.combinat.designs.design_catalog [4 tests, 1 failure, 0.73 s] sage -t --long src/sage/combinat/designs/covering_design.py [49 tests, 0.73 s] ---------------------------------------------------------------------- sage -t --long src/sage/combinat/designs/design_catalog.py # 1 doctest failed ---------------------------------------------------------------------- Total time for all tests: 0.8 seconds cpu time: 0.1 seconds cumulative wall time: 1.5 seconds External software detected for doctesting: internet
comment:9 Changed 3 years ago by
- Description modified (diff)
- Summary changed from covering_design.py : Fix AttributeError to covering_design.py & design_catalog.py: Fix AttributeError
comment:10 Changed 3 years ago by
- Commit changed from 1e93e496d263032fa34b4fba2be6931fb741faf5 to 138870cddda3f3a3f4aaa0ad2cc5a0de974a1750
Branch pushed to git repo; I updated commit sha1. New commits:
138870c | Trac #27821: Fix a doctest in design_catalog.py
|
comment:11 Changed 3 years ago by
- Status changed from needs_work to needs_review
The other doctest bug of design_catalog.py has been fixed.
comment:12 Changed 3 years ago by
- Keywords thursdaysbdx added
- Reviewers set to Sébastien Labbé
- Status changed from needs_review to positive_review
It works! Thank you.
comment:13 Changed 3 years ago by
- Branch changed from u/vklein/27821 to 138870cddda3f3a3f4aaa0ad2cc5a0de974a1750
- Resolution set to fixed
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
Is this a solution:
? This is what I used in #25535.