File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,35 @@ def test_csv_bytes_to_numpy_with_header():
7676 assert np .array_equiv (arr_out , expected )
7777
7878
79+ def test_csv_bytes_to_numpy_single_element ():
80+ lines = [
81+ b"-6.76206\n " ,
82+ ]
83+ expected = np .array (
84+ [
85+ [- 6.76206 ],
86+ ],
87+ dtype = np .float32 ,
88+ )
89+ arr_out = stancsv .csv_bytes_list_to_numpy (lines , includes_header = False )
90+ assert np .array_equiv (arr_out , expected )
91+
92+
93+ def test_csv_bytes_to_numpy_single_element_no_polars ():
94+ lines = [
95+ b"-6.76206\n " ,
96+ ]
97+ expected = np .array (
98+ [
99+ [- 6.76206 ],
100+ ],
101+ dtype = np .float32 ,
102+ )
103+ with mock .patch .dict ("sys.modules" , {"polars" : None }):
104+ arr_out = stancsv .csv_bytes_list_to_numpy (lines , includes_header = False )
105+ assert np .array_equiv (arr_out , expected )
106+
107+
79108def test_csv_bytes_to_numpy_with_header_no_polars ():
80109 lines = [
81110 (
You can’t perform that action at this time.
0 commit comments