-
-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
register test_sparse in
run_tests.py
- Loading branch information
Showing
2 changed files
with
27 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import unittest | ||
|
||
from pulp.sparse import Matrix | ||
|
||
|
||
def test_sparse(): | ||
rows = list(range(10)) | ||
cols = list(range(50, 60)) | ||
mat = Matrix(rows, cols) | ||
mat.add(1, 52, "item") | ||
mat.add(2, 54, "stuff") | ||
assert mat.col_based_arrays() == ( | ||
2, | ||
[0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2], | ||
[0, 0, 1, 0, 1, 0, 0, 0, 0, 0], | ||
[1, 2], | ||
["item", "stuff"], | ||
) | ||
class SparseTest(unittest.TestCase): | ||
def test_sparse(self): | ||
rows = list(range(10)) | ||
cols = list(range(50, 60)) | ||
mat = Matrix(rows, cols) | ||
mat.add(1, 52, "item") | ||
mat.add(2, 54, "stuff") | ||
assert mat.col_based_arrays() == ( | ||
2, | ||
[0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2], | ||
[0, 0, 1, 0, 1, 0, 0, 0, 0, 0], | ||
[1, 2], | ||
["item", "stuff"], | ||
) |