@@ -88,6 +88,43 @@ def test_ncell_attribute(self):
88
88
with self .assertRaises (TypeError ):
89
89
tiledb .Attr ("foo" , dtype = np .dtype ([("" , np .float32 ), ("" , np .int32 )]))
90
90
91
+ def test_complex64_attribute (self ):
92
+ attr = tiledb .Attr ("foo" , fill = (0 + 1j ), dtype = np .dtype ("complex64" ))
93
+ assert attr == attr
94
+ assert attr .fill == attr .fill
95
+ assert attr .dtype == np .complex64
96
+ assert attr .ncells == 2
97
+
98
+ def test_complex128_attribute (self ):
99
+ dtype = np .dtype ([("" , np .double ), ("" , np .double )])
100
+ attr = tiledb .Attr ("foo" , fill = (2.0 , 2.0 ), dtype = dtype )
101
+
102
+ assert attr == attr
103
+ assert attr .fill == attr .fill
104
+ assert attr .dtype == np .complex128
105
+ assert attr .ncells == 2
106
+
107
+ @pytest .mark .parametrize (
108
+ "fill" , [(1.0 , 1.0 ), np .array ((1.0 , 1.0 ), dtype = np .dtype ("f4, f4" ))]
109
+ )
110
+ def test_two_cell_float_attribute (self , fill ):
111
+ attr = tiledb .Attr ("foo" , fill = fill , dtype = np .dtype ("f4, f4" ))
112
+
113
+ assert attr == attr
114
+ assert attr .dtype == np .complex64
115
+ assert attr .fill == attr .fill
116
+ assert attr .ncells == 2
117
+
118
+ @pytest .mark .parametrize (
119
+ "fill" , [(1.0 , 1.0 ), np .array ((1.0 , 1.0 ), dtype = np .dtype ("f8, f8" ))]
120
+ )
121
+ def test_two_cell_double_attribute (self , fill ):
122
+ attr = tiledb .Attr ("foo" , fill = fill , dtype = np .dtype ("f8, f8" ))
123
+ assert attr == attr
124
+ assert attr .dtype == np .complex128
125
+ assert attr .fill == attr .fill
126
+ assert attr .ncells == 2
127
+
91
128
def test_ncell_bytes_attribute (self ):
92
129
dtype = np .dtype ((np .bytes_ , 10 ))
93
130
attr = tiledb .Attr ("foo" , dtype = dtype )
0 commit comments