2
2
3
3
from tests .testcase import BaseTestCase
4
4
from proton_driver import errors
5
- from tests .util import require_server_version
6
5
7
6
8
- class ArrayTestCase (BaseTestCase ):
7
+ class arrayTestCase (BaseTestCase ):
9
8
def test_empty (self ):
10
- columns = 'a Array(Int32 )'
9
+ columns = 'a array(int32 )'
11
10
12
11
data = [([], )]
13
- with self .create_table (columns ):
12
+ with self .create_stream (columns ):
14
13
self .client .execute (
15
14
'INSERT INTO test (a) VALUES' , data
16
15
)
@@ -25,10 +24,10 @@ def test_empty(self):
25
24
self .assertEqual (inserted , data )
26
25
27
26
def test_simple (self ):
28
- columns = 'a Array(Int32 )'
27
+ columns = 'a array(int32 )'
29
28
data = [([100 , 500 ], )]
30
29
31
- with self .create_table (columns ):
30
+ with self .create_stream (columns ):
32
31
self .client .execute (
33
32
'INSERT INTO test (a) VALUES' , data
34
33
)
@@ -43,10 +42,10 @@ def test_simple(self):
43
42
self .assertEqual (inserted , data )
44
43
45
44
def test_write_column_as_nested_array (self ):
46
- columns = 'a Array(Int32 )'
45
+ columns = 'a array(int32 )'
47
46
data = [([100 , 500 ], ), ([100 , 500 ], )]
48
47
49
- with self .create_table (columns ):
48
+ with self .create_stream (columns ):
50
49
self .client .execute (
51
50
'INSERT INTO test (a) VALUES' , data
52
51
)
@@ -61,10 +60,10 @@ def test_write_column_as_nested_array(self):
61
60
self .assertEqual (inserted , data )
62
61
63
62
def test_nested_with_enum (self ):
64
- columns = "a Array(Array(Enum8 ('hello' = -1, 'world' = 2)))"
63
+ columns = "a array(array(enum8 ('hello' = -1, 'world' = 2)))"
65
64
66
65
data = [([['hello' , 'world' ], ['hello' ]], )]
67
- with self .create_table (columns ):
66
+ with self .create_stream (columns ):
68
67
self .client .execute (
69
68
'INSERT INTO test (a) VALUES' , data
70
69
)
@@ -79,7 +78,7 @@ def test_nested_with_enum(self):
79
78
self .assertEqual (inserted , data )
80
79
81
80
def test_nested_of_nested (self ):
82
- columns = 'a Array(Array(Array(Int32 ))), b Array(Array(Array(Int32 )))'
81
+ columns = 'a array(array(array(int32 ))), b array(array(array(int32 )))'
83
82
data = [([
84
83
[[255 , 170 ], [127 , 127 , 127 , 127 , 127 ], [170 , 170 , 170 ], [170 ]],
85
84
[[255 , 255 , 255 ], [255 ]], [[255 ], [255 ], [255 ]]
@@ -88,7 +87,7 @@ def test_nested_of_nested(self):
88
87
[[255 , 255 , 255 ], [255 ]], [[255 ], [255 ], [255 ]]
89
88
])]
90
89
91
- with self .create_table (columns ):
90
+ with self .create_stream (columns ):
92
91
self .client .execute (
93
92
'INSERT INTO test (a, b) VALUES' , data
94
93
)
@@ -107,12 +106,12 @@ def test_nested_of_nested(self):
107
106
self .assertEqual (inserted , data )
108
107
109
108
def test_multidimensional (self ):
110
- columns = "a Array(Array(Array(Nullable(String ))))"
109
+ columns = "a array(array(array(nullable(string ))))"
111
110
data = [([[['str1_1' , 'str1_2' , None ], [None ]],
112
111
[['str1_3' , 'str1_4' , None ], [None ]]], ),
113
112
([[['str2_1' , 'str2_2' , None ], [None ]]], ),
114
113
([[['str3_1' , 'str3_2' , None ], [None ]]],)]
115
- with self .create_table (columns ):
114
+ with self .create_stream (columns ):
116
115
self .client .execute (
117
116
'INSERT INTO test (a) VALUES' , data
118
117
)
@@ -131,12 +130,12 @@ def test_multidimensional(self):
131
130
self .assertEqual (inserted , data )
132
131
133
132
def test_empty_nested (self ):
134
- columns = "a Array(Array(Array(Int32 ))), b Array(Array(Array(Int32 )))"
133
+ columns = "a array(array(array(int32 ))), b array(array(array(int32 )))"
135
134
data = [
136
135
([], [[]],),
137
136
]
138
137
139
- with self .create_table (columns ):
138
+ with self .create_stream (columns ):
140
139
self .client .execute ("INSERT INTO test (a, b) VALUES" , data )
141
140
142
141
query = "SELECT * FROM test"
@@ -149,24 +148,24 @@ def test_empty_nested(self):
149
148
self .assertEqual (inserted , data )
150
149
151
150
def test_type_mismatch_error (self ):
152
- columns = 'a Array(Int32 )'
151
+ columns = 'a array(int32 )'
153
152
data = [('test' , )]
154
153
155
- with self .create_table (columns ):
154
+ with self .create_stream (columns ):
156
155
with self .assertRaises (errors .TypeMismatchError ):
157
156
self .client .execute ('INSERT INTO test (a) VALUES' , data )
158
157
159
158
data = [(['test' ], )]
160
159
161
- with self .create_table (columns ):
160
+ with self .create_stream (columns ):
162
161
with self .assertRaises (errors .TypeMismatchError ):
163
162
self .client .execute ('INSERT INTO test (a) VALUES' , data )
164
163
165
164
def test_string_array (self ):
166
- columns = 'a Array(String )'
165
+ columns = 'a array(string )'
167
166
data = [(['aaa' , 'bbb' ], )]
168
167
169
- with self .create_table (columns ):
168
+ with self .create_stream (columns ):
170
169
self .client .execute (
171
170
'INSERT INTO test (a) VALUES' , data
172
171
)
@@ -181,10 +180,10 @@ def test_string_array(self):
181
180
self .assertEqual (inserted , data )
182
181
183
182
def test_string_nullable_array (self ):
184
- columns = 'a Array(Nullable(String ))'
183
+ columns = 'a array(nullable(string ))'
185
184
data = [(['aaa' , None , 'bbb' ], )]
186
185
187
- with self .create_table (columns ):
186
+ with self .create_stream (columns ):
188
187
self .client .execute (
189
188
'INSERT INTO test (a) VALUES' , data
190
189
)
@@ -199,13 +198,13 @@ def test_string_nullable_array(self):
199
198
self .assertEqual (inserted , data )
200
199
201
200
def test_uuid_array (self ):
202
- columns = 'a Array(UUID )'
201
+ columns = 'a array(uuid )'
203
202
data = [([
204
203
UUID ('c0fcbba9-0752-44ed-a5d6-4dfb4342b89d' ),
205
204
UUID ('2efcead4-ff55-4db5-bdb4-6b36a308d8e0' )
206
205
], )]
207
206
208
- with self .create_table (columns ):
207
+ with self .create_stream (columns ):
209
208
self .client .execute (
210
209
'INSERT INTO test (a) VALUES' , data
211
210
)
@@ -222,14 +221,14 @@ def test_uuid_array(self):
222
221
self .assertEqual (inserted , data )
223
222
224
223
def test_uuid_nullable_array (self ):
225
- columns = 'a Array(Nullable(UUID ))'
224
+ columns = 'a array(nullable(uuid ))'
226
225
data = [([
227
226
UUID ('c0fcbba9-0752-44ed-a5d6-4dfb4342b89d' ),
228
227
None ,
229
228
UUID ('2efcead4-ff55-4db5-bdb4-6b36a308d8e0' )
230
229
], )]
231
230
232
- with self .create_table (columns ):
231
+ with self .create_stream (columns ):
233
232
self .client .execute (
234
233
'INSERT INTO test (a) VALUES' , data
235
234
)
@@ -246,12 +245,12 @@ def test_uuid_nullable_array(self):
246
245
inserted = self .client .execute (query )
247
246
self .assertEqual (inserted , data )
248
247
249
- @require_server_version (19 , 16 , 13 )
248
+ # @require_server_version(19, 16, 13)
250
249
def test_tuple_array (self ):
251
- columns = 'a Array(Tuple(Int32 ))'
250
+ columns = 'a array(tuple(int32 ))'
252
251
data = [([], )]
253
252
254
- with self .create_table (columns ):
253
+ with self .create_stream (columns ):
255
254
self .client .execute (
256
255
'INSERT INTO test (a) VALUES' , data
257
256
)
0 commit comments