Skip to content

Commit a0728c2

Browse files
Add tests for issparse method
Adds comprehensive tests for the issparse method including: - Testing issparse returns false for VectorOfArray - Testing issparse returns false for DiffEqArray - Testing the original issue with SubArray views - Testing nested VectorOfArray structures 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 9f06021 commit a0728c2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/interface_tests.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,24 @@ end
303303
darr = DiffEqArray([ones(2)], [1.0], :params, :sys)
304304
@test darr.sys == :sys
305305
end
306+
307+
@testset "issparse for AbstractVectorOfArray (issue #486)" begin
308+
using SparseArrays
309+
310+
# Test that issparse returns false for VectorOfArray
311+
testva = VectorOfArray([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
312+
@test issparse(testva) == false
313+
314+
# Test that issparse returns false for DiffEqArray
315+
testda = DiffEqArray([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1:3)
316+
@test issparse(testda) == false
317+
318+
# Test the original issue: issparse should work with SubArray views
319+
# This was failing before because issparse(::SubArray) calls issparse on the parent
320+
testview = view(testva, :, :)
321+
@test issparse(testview) == false
322+
323+
# Test with nested VectorOfArray
324+
nested_voa = VectorOfArray([testva, testva])
325+
@test issparse(nested_voa) == false
326+
end

0 commit comments

Comments
 (0)