@@ -136,17 +136,10 @@ def test_csv_bytes_to_numpy_with_header_no_polars():
136136 assert np .array_equal (arr_out , expected )
137137
138138
139- def test_csv_bytes_to_numpy_empty ():
140- lines = [b"" ]
141- with pytest .raises (ValueError ):
142- stancsv .csv_bytes_list_to_numpy (lines )
143-
144-
145- def test_csv_bytes_to_numpy_empty_no_polars ():
146- lines = [b"" ]
147- with without_import ("polars" , cmdstanpy .utils .stancsv ):
148- with pytest .raises (ValueError ):
149- stancsv .csv_bytes_list_to_numpy (lines )
139+ def test_csv_bytes_empty ():
140+ lines = []
141+ arr = stancsv .csv_bytes_list_to_numpy (lines )
142+ assert np .array_equal (arr , np .empty ((0 ,)))
150143
151144
152145def test_csv_bytes_to_numpy_header_no_draws ():
@@ -156,8 +149,8 @@ def test_csv_bytes_to_numpy_header_no_draws():
156149 b"n_leapfrog__,divergent__,energy__,theta\n "
157150 ),
158151 ]
159- with pytest . raises ( ValueError ):
160- stancsv . csv_bytes_list_to_numpy ( lines )
152+ arr = stancsv . csv_bytes_list_to_numpy ( lines )
153+ assert arr . shape == ( 0 , 8 )
161154
162155
163156def test_csv_bytes_to_numpy_header_no_draws_no_polars ():
@@ -168,8 +161,8 @@ def test_csv_bytes_to_numpy_header_no_draws_no_polars():
168161 ),
169162 ]
170163 with without_import ("polars" , cmdstanpy .utils .stancsv ):
171- with pytest . raises ( ValueError ):
172- stancsv . csv_bytes_list_to_numpy ( lines )
164+ arr = stancsv . csv_bytes_list_to_numpy ( lines )
165+ assert arr . shape == ( 0 , 8 )
173166
174167
175168def test_parse_comments_and_draws ():
0 commit comments