diff --git a/tests/test_sparse.py b/tests/test_sparse.py index 184ae398..78ef158b 100644 --- a/tests/test_sparse.py +++ b/tests/test_sparse.py @@ -790,6 +790,13 @@ def test_sparse_array_indexing(): sa[[0, 1]] = [[[0, 1]]] # Broadcast 3-d array to 2-d sa[[0, 1], 0] = [[0, 1]] # Reduce dimensions + + # Check closed and open slices + sa = SparseArray.from_shape([5, 5]) + sa[0:3, :] = 1 + arr = np.zeros([5, 5]) + arr[0:3, :] = 1 + assert (sa == arr).all() def test_sparse_array_boolean_indexing(): for dtype in (float, bool): diff --git a/thermosteam/base/sparse.py b/thermosteam/base/sparse.py index 51940c11..a1ecf443 100644 --- a/thermosteam/base/sparse.py +++ b/thermosteam/base/sparse.py @@ -820,7 +820,7 @@ def __setitem__(self, index, value): rows = [rows[i] for i in default_range(m, len(rows))] if n.__class__ is slice: if n == open_slice: - self[:] = value + for i in rows: i[:] = value return else: n = default_range(n, self.vector_size)