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

Commit 987f609

Browse files
author
Matthias Koeppe
committed
GenericBackend._test_add_linear_constraints: Add tests from COINBackend, CVXOPTBackend
1 parent 941d30b commit 987f609

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/sage/numerical/backends/generic_backend.pyx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,10 @@ cdef class GenericBackend:
594594
sage: from sage.numerical.backends.generic_backend import GenericBackend
595595
sage: p = GenericBackend()
596596
sage: p._test_add_linear_constraints()
597+
...
597598
Traceback (most recent call last):
598599
...
599-
NotImplementedError
600+
NotImplementedError...
600601
"""
601602
p = cls() # fresh instance of the backend
602603
if tester is None:
@@ -611,8 +612,11 @@ cdef class GenericBackend:
611612
for i in range(nrows_before, nrows_after):
612613
tester.assertEqual(p.row(i), ([], []))
613614
tester.assertEqual(p.row_bounds(i), (None, 2.0))
614-
# FIXME: Not sure if we should test that no new variables were added.
615-
# Perhaps some backend may need to introduce explicit slack variables?
615+
# Test from COINBackend.add_linear_constraints:
616+
tester.assertIsNone(p.add_linear_constraints(2, None, 2, names=['foo', 'bar']))
617+
tester.assertEqual(p.row_name(6), 'bar')
618+
# Test that it did not add mysterious new variables:
619+
tester.assertEqual(p.ncols(), 0)
616620

617621
cpdef int solve(self) except -1:
618622
"""

0 commit comments

Comments
 (0)