@@ -92,3 +92,45 @@ def test_execute_with_converter(self):
92
92
self .assertEqual (result , ['foo' , '10.10.10.1' , 1658167836758 , "B'0110'" ])
93
93
94
94
conn .close ()
95
+
96
+ def test_execute_array_with_converter (self ):
97
+ client = ClientMocked ()
98
+ conn = connect (client = client )
99
+ converter = Cursor .get_default_converter ()
100
+ cursor = conn .cursor (converter = converter )
101
+
102
+ conn .client .set_next_response ({
103
+ "col_types" : [4 , [100 , 5 ]],
104
+ "cols" : ["name" , "address" ],
105
+ "rows" : [["foo" , ["10.10.10.1" , "10.10.10.2" ]]],
106
+ "rowcount" : 1 ,
107
+ "duration" : 123
108
+ })
109
+
110
+ cursor .execute ("" )
111
+ result = cursor .fetchone ()
112
+ self .assertEqual (result , [
113
+ 'foo' ,
114
+ [IPv4Address ('10.10.10.1' ), IPv4Address ('10.10.10.2' )],
115
+ ])
116
+
117
+ def test_execute_nested_array_with_converter (self ):
118
+ client = ClientMocked ()
119
+ conn = connect (client = client )
120
+ converter = Cursor .get_default_converter ()
121
+ cursor = conn .cursor (converter = converter )
122
+
123
+ conn .client .set_next_response ({
124
+ "col_types" : [4 , [100 , [100 , 5 ]]],
125
+ "cols" : ["name" , "address_buckets" ],
126
+ "rows" : [["foo" , [["10.10.10.1" , "10.10.10.2" ], ["10.10.10.3" ], [], None ]]],
127
+ "rowcount" : 1 ,
128
+ "duration" : 123
129
+ })
130
+
131
+ cursor .execute ("" )
132
+ result = cursor .fetchone ()
133
+ self .assertEqual (result , [
134
+ 'foo' ,
135
+ [[IPv4Address ('10.10.10.1' ), IPv4Address ('10.10.10.2' )], [IPv4Address ('10.10.10.3' )], [], None ],
136
+ ])
0 commit comments