Skip to content

Commit a920f04

Browse files
committed
Improved tests [skip ci]
1 parent 605482b commit a920f04

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/test_sparse_vector.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def test_list(self):
2323
assert np.array_equal(vec.to_numpy(), [1, 0, 2, 0, 3, 0])
2424
assert vec.indices() == [0, 2, 4]
2525

26+
def test_list_empty(self):
27+
assert SparseVector([]).to_list() == []
28+
2629
def test_list_dimensions(self):
2730
with pytest.raises(ValueError) as error:
2831
SparseVector([1, 0, 2, 0, 3, 0], 6) # ty: ignore[invalid-argument-type]
@@ -39,6 +42,9 @@ def test_dict(self):
3942
assert vec.to_list() == [1, 0, 2, 0, 3, 0]
4043
assert vec.indices() == [0, 2, 4]
4144

45+
def test_dict_empty(self):
46+
assert SparseVector({}, 0).to_list() == []
47+
4248
def test_dict_no_dimensions(self):
4349
with pytest.raises(ValueError) as error:
4450
SparseVector({0: 1, 2: 2, 4: 3})

0 commit comments

Comments
 (0)