@@ -1037,11 +1037,11 @@ def random_subtype_vector():
1037
1037
test_fn (observed2 [idx ], expected2 [idx ])
1038
1038
1039
1039
def test_round_trip_integers (self ):
1040
- self ._round_trip_test ("int" , partial (random .randint , 0 , 2 ** 31 ), self . assertEqual )
1041
- self ._round_trip_test ("bigint" , partial (random .randint , 0 , 2 ** 63 ), self . assertEqual )
1042
- self ._round_trip_test ("smallint" , partial (random .randint , 0 , 2 ** 15 ), self . assertEqual )
1043
- self ._round_trip_test ("tinyint" , partial (random .randint , 0 , (2 ** 7 ) - 1 ), self . assertEqual )
1044
- self ._round_trip_test ("varint" , partial (random .randint , 0 , 2 ** 63 ), self . assertEqual )
1040
+ self ._round_trip_test ("int" , partial (random .randint , 0 , 2 ** 31 ), assertEqual )
1041
+ self ._round_trip_test ("bigint" , partial (random .randint , 0 , 2 ** 63 ), assertEqual )
1042
+ self ._round_trip_test ("smallint" , partial (random .randint , 0 , 2 ** 15 ), assertEqual )
1043
+ self ._round_trip_test ("tinyint" , partial (random .randint , 0 , (2 ** 7 ) - 1 ), assertEqual )
1044
+ self ._round_trip_test ("varint" , partial (random .randint , 0 , 2 ** 63 ), assertEqual )
1045
1045
1046
1046
def test_round_trip_floating_point (self ):
1047
1047
_almost_equal_test_fn = partial (pytest .approx , abs = 1e-5 )
@@ -1058,8 +1058,8 @@ def test_round_trip_text(self):
1058
1058
def _random_string ():
1059
1059
return '' .join (random .choice (string .ascii_uppercase + string .digits ) for _ in range (24 ))
1060
1060
1061
- self ._round_trip_test ("ascii" , _random_string , self . assertEqual )
1062
- self ._round_trip_test ("text" , _random_string , self . assertEqual )
1061
+ self ._round_trip_test ("ascii" , _random_string , assertEqual )
1062
+ self ._round_trip_test ("text" , _random_string , assertEqual )
1063
1063
1064
1064
def test_round_trip_date_and_time (self ):
1065
1065
_almost_equal_test_fn = partial (pytest .approx , abs = timedelta (seconds = 1 ))
@@ -1070,13 +1070,13 @@ def _random_date():
1070
1070
def _random_time ():
1071
1071
return _random_datetime ().time ()
1072
1072
1073
- self ._round_trip_test ("date" , _random_date , self . assertEqual )
1074
- self ._round_trip_test ("time" , _random_time , self . assertEqual )
1073
+ self ._round_trip_test ("date" , _random_date , assertEqual )
1074
+ self ._round_trip_test ("time" , _random_time , assertEqual )
1075
1075
self ._round_trip_test ("timestamp" , _random_datetime , _almost_equal_test_fn )
1076
1076
1077
1077
def test_round_trip_uuid (self ):
1078
- self ._round_trip_test ("uuid" , uuid .uuid1 , self . assertEqual )
1079
- self ._round_trip_test ("timeuuid" , uuid .uuid1 , self . assertEqual )
1078
+ self ._round_trip_test ("uuid" , uuid .uuid1 , assertEqual )
1079
+ self ._round_trip_test ("timeuuid" , uuid .uuid1 , assertEqual )
1080
1080
1081
1081
def test_round_trip_miscellany (self ):
1082
1082
def _random_bytes ():
@@ -1088,10 +1088,10 @@ def _random_duration():
1088
1088
def _random_inet ():
1089
1089
return socket .inet_ntoa (_random_bytes ())
1090
1090
1091
- self ._round_trip_test ("boolean" , _random_boolean , self . assertEqual )
1092
- self ._round_trip_test ("duration" , _random_duration , self . assertEqual )
1093
- self ._round_trip_test ("inet" , _random_inet , self . assertEqual )
1094
- self ._round_trip_test ("blob" , _random_bytes , self . assertEqual )
1091
+ self ._round_trip_test ("boolean" , _random_boolean , assertEqual )
1092
+ self ._round_trip_test ("duration" , _random_duration , assertEqual )
1093
+ self ._round_trip_test ("inet" , _random_inet , assertEqual )
1094
+ self ._round_trip_test ("blob" , _random_bytes , assertEqual )
1095
1095
1096
1096
def test_round_trip_collections (self ):
1097
1097
def _random_seq ():
@@ -1102,32 +1102,32 @@ def _random_map():
1102
1102
return {k :v for (k ,v ) in zip (_random_seq (), _random_seq ())}
1103
1103
1104
1104
# Goal here is to test collections of both fixed and variable size subtypes
1105
- self ._round_trip_test ("list<int>" , _random_seq , self . assertEqual )
1106
- self ._round_trip_test ("list<varint>" , _random_seq , self . assertEqual )
1107
- self ._round_trip_test ("set<int>" , _random_set , self . assertEqual )
1108
- self ._round_trip_test ("set<varint>" , _random_set , self . assertEqual )
1109
- self ._round_trip_test ("map<int,int>" , _random_map , self . assertEqual )
1110
- self ._round_trip_test ("map<int,varint>" , _random_map , self . assertEqual )
1111
- self ._round_trip_test ("map<varint,int>" , _random_map , self . assertEqual )
1112
- self ._round_trip_test ("map<varint,varint>" , _random_map , self . assertEqual )
1105
+ self ._round_trip_test ("list<int>" , _random_seq , assertEqual )
1106
+ self ._round_trip_test ("list<varint>" , _random_seq , assertEqual )
1107
+ self ._round_trip_test ("set<int>" , _random_set , assertEqual )
1108
+ self ._round_trip_test ("set<varint>" , _random_set , assertEqual )
1109
+ self ._round_trip_test ("map<int,int>" , _random_map , assertEqual )
1110
+ self ._round_trip_test ("map<int,varint>" , _random_map , assertEqual )
1111
+ self ._round_trip_test ("map<varint,int>" , _random_map , assertEqual )
1112
+ self ._round_trip_test ("map<varint,varint>" , _random_map , assertEqual )
1113
1113
1114
1114
def test_round_trip_vector_of_vectors (self ):
1115
1115
def _random_vector ():
1116
1116
return [random .randint (0 ,100000 ) for _ in range (2 )]
1117
1117
1118
- self ._round_trip_test ("vector<int,2>" , _random_vector , self . assertEqual )
1119
- self ._round_trip_test ("vector<varint,2>" , _random_vector , self . assertEqual )
1118
+ self ._round_trip_test ("vector<int,2>" , _random_vector , assertEqual )
1119
+ self ._round_trip_test ("vector<varint,2>" , _random_vector , assertEqual )
1120
1120
1121
1121
def test_round_trip_tuples (self ):
1122
1122
def _random_tuple ():
1123
1123
return (random .randint (0 ,100000 ),random .randint (0 ,100000 ))
1124
1124
1125
1125
# Unfortunately we can't use positional parameters when inserting tuples because the driver will try to encode
1126
1126
# them as lists before sending them to the server... and that confuses the parsing logic.
1127
- self ._round_trip_test ("tuple<int,int>" , _random_tuple , self . assertEqual , use_positional_parameters = False )
1128
- self ._round_trip_test ("tuple<int,varint>" , _random_tuple , self . assertEqual , use_positional_parameters = False )
1129
- self ._round_trip_test ("tuple<varint,int>" , _random_tuple , self . assertEqual , use_positional_parameters = False )
1130
- self ._round_trip_test ("tuple<varint,varint>" , _random_tuple , self . assertEqual , use_positional_parameters = False )
1127
+ self ._round_trip_test ("tuple<int,int>" , _random_tuple , assertEqual , use_positional_parameters = False )
1128
+ self ._round_trip_test ("tuple<int,varint>" , _random_tuple , assertEqual , use_positional_parameters = False )
1129
+ self ._round_trip_test ("tuple<varint,int>" , _random_tuple , assertEqual , use_positional_parameters = False )
1130
+ self ._round_trip_test ("tuple<varint,varint>" , _random_tuple , assertEqual , use_positional_parameters = False )
1131
1131
1132
1132
def test_round_trip_udts (self ):
1133
1133
def _udt_equal_test_fn (udt1 , udt2 ):
0 commit comments