Skip to content

Commit cfc0404

Browse files
committed
Added test for bad type [skip ci]
1 parent 858e6b1 commit cfc0404

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tests/test_sparse_vector.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ def test_list(self) -> None:
2626
def test_list_empty(self) -> None:
2727
assert SparseVector([]).to_list() == []
2828

29+
def test_list_str(self) -> None:
30+
with pytest.raises(ValueError, match='could not convert string to float') as error:
31+
SparseVector([1, 'two', 3]) # type: ignore
32+
2933
def test_list_dimensions(self) -> None:
3034
with pytest.raises(ValueError) as error:
3135
SparseVector([1, 0, 2, 0, 3, 0], 6) # type: ignore

0 commit comments

Comments
 (0)