Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
GenericBackend._test_add_linear_constraints: Add tests from COINBacke…
Browse files Browse the repository at this point in the history
…nd, CVXOPTBackend
  • Loading branch information
Matthias Koeppe committed May 24, 2016
1 parent 941d30b commit 987f609
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/sage/numerical/backends/generic_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,10 @@ cdef class GenericBackend:
sage: from sage.numerical.backends.generic_backend import GenericBackend
sage: p = GenericBackend()
sage: p._test_add_linear_constraints()
...
Traceback (most recent call last):
...
NotImplementedError
NotImplementedError...
"""
p = cls() # fresh instance of the backend
if tester is None:
Expand All @@ -611,8 +612,11 @@ cdef class GenericBackend:
for i in range(nrows_before, nrows_after):
tester.assertEqual(p.row(i), ([], []))
tester.assertEqual(p.row_bounds(i), (None, 2.0))
# FIXME: Not sure if we should test that no new variables were added.
# Perhaps some backend may need to introduce explicit slack variables?
# Test from COINBackend.add_linear_constraints:
tester.assertIsNone(p.add_linear_constraints(2, None, 2, names=['foo', 'bar']))
tester.assertEqual(p.row_name(6), 'bar')
# Test that it did not add mysterious new variables:
tester.assertEqual(p.ncols(), 0)

cpdef int solve(self) except -1:
"""
Expand Down

0 comments on commit 987f609

Please sign in to comment.