Opened 12 months ago
Closed 10 months ago
#31315 closed defect (fixed)
sage.numerical.backends: GenericBackend doctests failure in remove_constraints
Reported by: | yzh | Owned by: | |
---|---|---|---|
Priority: | trivial | Milestone: | sage-9.3 |
Component: | doctest coverage | Keywords: | |
Cc: | mkoeppe | Merged in: | |
Authors: | Yuan Zhou | Reviewers: | Matthias Koeppe |
Report Upstream: | N/A | Work issues: | |
Branch: | 6a93d7e (Commits, GitHub, GitLab) | Commit: | 6a93d7e72011c428fc9efd5264026ed9aef64f5f |
Dependencies: | Stopgaps: |
Description
Although the doctests in generic_backend
are purely decoration (disabled using optional - Nonexistent_LP_solver
), they provide template for copy paste to other backends. The following doctest from the method GenericBackend.remove_constraints
fails, because the backend p
does not have the methods new_variable
and add_constraints
. (These are methods of MixedIntegerLinearProgram
.)
sage: from sage.numerical.backends.generic_backend import get_solver sage: p = get_solver(solver = "Nonexistent_LP_solver") # optional - Nonexistent_LP_solver sage: p.add_constraint(p[0] + p[1], max = 10) # optional - Nonexistent_LP_solver sage: p.remove_constraints([0]) # optional - Nonexistent_LP_solver
Change History (7)
comment:1 Changed 12 months ago by
- Branch set to u/yzh/sage_numerical_backends__genericbackend_doctests_failure_in_remove_constraints
comment:2 Changed 12 months ago by
- Commit set to 6a93d7e72011c428fc9efd5264026ed9aef64f5f
- Status changed from new to needs_review
comment:3 Changed 12 months ago by
comment:4 follow-up: ↓ 5 Changed 12 months ago by
Are there copies of this test template in the backends that are correct?
comment:5 in reply to: ↑ 4 Changed 12 months ago by
Replying to mkoeppe:
Are there copies of this test template in the backends that are correct?
This method is not defined in most backends. Only glpk_backend.pyx
has it. The test there is correct, but it uses p = MixedIntegerLinearProgram(...)
instead.
comment:6 Changed 12 months ago by
- Priority changed from major to trivial
- Reviewers set to Matthias Koeppe
- Status changed from needs_review to positive_review
comment:7 Changed 10 months ago by
- Branch changed from u/yzh/sage_numerical_backends__genericbackend_doctests_failure_in_remove_constraints to 6a93d7e72011c428fc9efd5264026ed9aef64f5f
- Resolution set to fixed
- Status changed from positive_review to closed
Notice that
@classmethod _test_remove_constraint
and_test_remove_constraints
are missing. They should be added togeneric_backend_test.py
in #31103 later.New commits:
fix doctest