@@ -63,7 +63,8 @@ def test_ak_array_init():
6363 "a" : [1 , 2 , 3 , 4 ],
6464 "b" : [[1 , 2 ], [3 ], [4 ], [5 , 6 , 7 ]],
6565 "c" : {"f1" : [[], [5 ], [3 , 7 , 6 ], []], "f2" : [5 , 6 , 7 , 8 ]},
66- "d" : np .array ([[1 , 2 ], [3 , 4 ], [5 , 6 ], [7 , 8 ]]), # RegularType
66+ "d" : ["boh" , "hello" , "there" , "!" ],
67+ "e" : np .array ([[1 , 2 ], [3 , 4 ], [5 , 6 ], [7 , 8 ]]), # RegularType
6768 }
6869 )
6970 tbl = Table (array )
@@ -72,7 +73,29 @@ def test_ak_array_init():
7273 assert isinstance (tbl .c , Table )
7374 assert isinstance (tbl .c .f1 , lgdo .VectorOfVectors )
7475 assert isinstance (tbl .c .f2 , lgdo .Array )
75- assert isinstance (tbl .d , lgdo .ArrayOfEqualSizedArrays )
76+ assert isinstance (tbl .e , lgdo .ArrayOfEqualSizedArrays )
77+
78+
79+ def test_ak_array_init_attrs ():
80+ array = ak .Array (
81+ {
82+ "a" : ak .with_parameter ([1 , 2 , 3 , 4 ], "units" , "mm" ),
83+ "b" : ak .with_parameter ([[1 , 2 ], [3 ], [4 ], [5 , 6 , 7 ]], "units" , "keV" ),
84+ "c" : {
85+ "f1" : [[], [5 ], [3 , 7 , 6 ], []],
86+ "f2" : ak .with_parameter ([5 , 6 , 7 , 8 ], "units" , "C" ),
87+ },
88+ }
89+ )
90+ tbl = Table (array )
91+ assert isinstance (tbl .a , lgdo .Array )
92+ assert tbl .a .attrs ["units" ] == "mm"
93+ assert isinstance (tbl .b , lgdo .VectorOfVectors )
94+ assert tbl .b .attrs ["units" ] == "keV"
95+ assert isinstance (tbl .c , Table )
96+ assert isinstance (tbl .c .f1 , lgdo .VectorOfVectors )
97+ assert isinstance (tbl .c .f2 , lgdo .Array )
98+ assert tbl .c .f2 .attrs ["units" ] == "C"
7699
77100
78101def test_datatype_name ():
0 commit comments