@@ -32,15 +32,18 @@ def test_only_one_dtype(test_data, df_from_dict):
32
32
def test_mixed_dtypes (df_from_dict ):
33
33
df = df_from_dict (
34
34
{
35
- "a" : [1 , 2 , 3 ],
36
- "b" : [3 , 4 , 5 ],
37
- "c" : [1.5 , 2.5 , 3.5 ],
38
- "d" : [9 , 10 , 11 ],
39
- "e" : [True , False , True ],
40
- "f" : ["a" , "" , "c" ],
35
+ "a" : [1 , 2 , 3 ], # dtype kind INT = 0
36
+ "b" : [3 , 4 , 5 ], # dtype kind INT = 0
37
+ "c" : [1.5 , 2.5 , 3.5 ], # dtype kind FLOAT = 2
38
+ "d" : [9 , 10 , 11 ], # dtype kind INT = 0
39
+ "e" : [True , False , True ], # dtype kind BOOLEAN = 20
40
+ "f" : ["a" , "" , "c" ], # dtype kind STRING = 21
41
41
}
42
42
)
43
43
dfX = df .__dataframe__ ()
44
+ # for meanings of dtype[0] see the spec; we cannot import the spec here as this
45
+ # file is expected to be vendored *anywhere*;
46
+ # values for dtype[0] are explained above
44
47
columns = {"a" : 0 , "b" : 0 , "c" : 2 , "d" : 0 , "e" : 20 , "f" : 21 }
45
48
46
49
for column , kind in columns .items ():
@@ -120,8 +123,10 @@ def test_get_columns(df_from_dict):
120
123
for colX in dfX .get_columns ():
121
124
assert colX .size == 2
122
125
assert colX .num_chunks () == 1
123
- assert dfX .get_column (0 ).dtype [0 ] == 0
124
- assert dfX .get_column (1 ).dtype [0 ] == 2
126
+ # for meanings of dtype[0] see the spec; we cannot import the spec here as this
127
+ # file is expected to be vendored *anywhere*
128
+ assert dfX .get_column (0 ).dtype [0 ] == 0 # INT
129
+ assert dfX .get_column (1 ).dtype [0 ] == 2 # FLOAT
125
130
126
131
127
132
def test_buffer (df_from_dict ):
@@ -137,7 +142,9 @@ def test_buffer(df_from_dict):
137
142
assert dataBuf .ptr != 0
138
143
device , _ = dataBuf .__dlpack_device__ ()
139
144
140
- assert dataDtype [0 ] == 0
145
+ # for meanings of dtype[0] see the spec; we cannot import the spec here as this
146
+ # file is expected to be vendored *anywhere*
147
+ assert dataDtype [0 ] == 0 # INT
141
148
142
149
if device == 1 : # CPU-only as we're going to directly read memory here
143
150
bitwidth = dataDtype [1 ]
0 commit comments