@@ -454,6 +454,8 @@ class _matrix:
|
||||
raise IndexError('Row index out of bounds')
|
||||
else:
|
||||
# Single row
|
||||
if key[0] >= self.__rows:
|
||||
raise IndexError('Row index out of bounds')
|
||||
rows = [key[0]]
|
||||
|
||||
# Columns
|
||||
@@ -468,6 +470,8 @@ class _matrix:
|
||||
|
||||
else:
|
||||
# Single column
|
||||
if key[1] >= self.__cols:
|
||||
raise IndexError('Column index out of bounds')
|
||||
columns = [key[1]]
|
||||
|
||||
# Create matrix slice
|
||||
|
||||
@@ -49,6 +49,8 @@ def test_matrix_basic():
|
||||
assert A9 != A10
|
||||
assert nstr(A9)
|
||||
assert A9 != None # issue 283
|
||||
pytest.raises(IndexError, lambda: zeros(1,1)[:, 1]) # issue 318
|
||||
pytest.raises(IndexError, lambda: zeros(1,1)[1, :])
|
||||
|
||||
def test_matmul():
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user