@@ -48,8 +48,8 @@ def transform_assert_equal(request):
48
48
@pytest .mark .parametrize (
49
49
"input_kwargs,result_kwargs" ,
50
50
[
51
- (dict (), dict ( dtype = np .int64 ) ),
52
- (dict ( errors = " coerce" , downcast = " integer"), dict ( dtype = np .int8 ) ),
51
+ ({}, { " dtype" : np .int64 } ),
52
+ ({ " errors" : " coerce" , " downcast" : " integer"}, { " dtype" : np .int8 } ),
53
53
],
54
54
)
55
55
def test_empty (input_kwargs , result_kwargs ):
@@ -147,10 +147,10 @@ def test_list():
147
147
@pytest .mark .parametrize (
148
148
"data,arr_kwargs" ,
149
149
[
150
- ([1 , 3 , 4 , 5 ], dict ( dtype = np .int64 ) ),
151
- ([1.0 , 3.0 , 4.0 , 5.0 ], dict () ),
150
+ ([1 , 3 , 4 , 5 ], { " dtype" : np .int64 } ),
151
+ ([1.0 , 3.0 , 4.0 , 5.0 ], {} ),
152
152
# Boolean is regarded as numeric.
153
- ([True , False , True , True ], dict () ),
153
+ ([True , False , True , True ], {} ),
154
154
],
155
155
)
156
156
def test_list_numeric (data , arr_kwargs ):
@@ -159,7 +159,7 @@ def test_list_numeric(data, arr_kwargs):
159
159
tm .assert_numpy_array_equal (result , expected )
160
160
161
161
162
- @pytest .mark .parametrize ("kwargs" , [dict ( dtype = "O" ), dict () ])
162
+ @pytest .mark .parametrize ("kwargs" , [{ " dtype" : "O" }, {} ])
163
163
def test_numeric (kwargs ):
164
164
data = [1 , - 3.14 , 7 ]
165
165
@@ -182,13 +182,13 @@ def test_numeric(kwargs):
182
182
def test_numeric_df_columns (columns ):
183
183
# see gh-14827
184
184
df = DataFrame (
185
- dict (
186
- a = [1.2 , decimal .Decimal (3.14 ), decimal .Decimal ("infinity" ), "0.1" ],
187
- b = [1.0 , 2.0 , 3.0 , 4.0 ],
188
- )
185
+ {
186
+ "a" : [1.2 , decimal .Decimal (3.14 ), decimal .Decimal ("infinity" ), "0.1" ],
187
+ "b" : [1.0 , 2.0 , 3.0 , 4.0 ],
188
+ }
189
189
)
190
190
191
- expected = DataFrame (dict ( a = [1.2 , 3.14 , np .inf , 0.1 ], b = [1.0 , 2.0 , 3.0 , 4.0 ]) )
191
+ expected = DataFrame ({ "a" : [1.2 , 3.14 , np .inf , 0.1 ], "b" : [1.0 , 2.0 , 3.0 , 4.0 ]} )
192
192
193
193
df_copy = df .copy ()
194
194
df_copy [columns ] = df_copy [columns ].apply (to_numeric )
@@ -208,10 +208,10 @@ def test_numeric_df_columns(columns):
208
208
)
209
209
def test_numeric_embedded_arr_likes (data , exp_data ):
210
210
# Test to_numeric with embedded lists and arrays
211
- df = DataFrame (dict ( a = data ) )
211
+ df = DataFrame ({ "a" : data } )
212
212
df ["a" ] = df ["a" ].apply (to_numeric )
213
213
214
- expected = DataFrame (dict ( a = exp_data ) )
214
+ expected = DataFrame ({ "a" : exp_data } )
215
215
tm .assert_frame_equal (df , expected )
216
216
217
217
@@ -226,7 +226,7 @@ def test_all_nan():
226
226
def test_type_check (errors ):
227
227
# see gh-11776
228
228
df = DataFrame ({"a" : [1 , - 3.14 , 7 ], "b" : ["4" , "5" , "6" ]})
229
- kwargs = dict ( errors = errors ) if errors is not None else dict ()
229
+ kwargs = { " errors" : errors } if errors is not None else {}
230
230
error_ctx = pytest .raises (TypeError , match = "1-d array" )
231
231
232
232
with error_ctx :
@@ -241,7 +241,7 @@ def test_scalar(val, signed, transform):
241
241
242
242
def test_really_large_scalar (large_val , signed , transform , errors ):
243
243
# see gh-24910
244
- kwargs = dict ( errors = errors ) if errors is not None else dict ()
244
+ kwargs = { " errors" : errors } if errors is not None else {}
245
245
val = - large_val if signed else large_val
246
246
247
247
val = transform (val )
@@ -258,7 +258,7 @@ def test_really_large_scalar(large_val, signed, transform, errors):
258
258
259
259
def test_really_large_in_arr (large_val , signed , transform , multiple_elts , errors ):
260
260
# see gh-24910
261
- kwargs = dict ( errors = errors ) if errors is not None else dict ()
261
+ kwargs = { " errors" : errors } if errors is not None else {}
262
262
val = - large_val if signed else large_val
263
263
val = transform (val )
264
264
@@ -300,7 +300,7 @@ def test_really_large_in_arr_consistent(large_val, signed, multiple_elts, errors
300
300
#
301
301
# Even if we discover that we have to hold float, does not mean
302
302
# we should be lenient on subsequent elements that fail to be integer.
303
- kwargs = dict ( errors = errors ) if errors is not None else dict ()
303
+ kwargs = { " errors" : errors } if errors is not None else {}
304
304
arr = [str (- large_val if signed else large_val )]
305
305
306
306
if multiple_elts :
@@ -452,12 +452,12 @@ def test_errors_invalid_value():
452
452
"kwargs,exp_dtype" ,
453
453
[
454
454
# Basic function tests.
455
- (dict () , np .int64 ),
456
- (dict ( downcast = None ) , np .int64 ),
455
+ ({} , np .int64 ),
456
+ ({ " downcast" : None } , np .int64 ),
457
457
# Support below np.float32 is rare and far between.
458
- (dict ( downcast = " float") , np .dtype (np .float32 ).char ),
458
+ ({ " downcast" : " float"} , np .dtype (np .float32 ).char ),
459
459
# Basic dtype support.
460
- (dict ( downcast = " unsigned") , np .dtype (np .typecodes ["UnsignedInteger" ][0 ])),
460
+ ({ " downcast" : " unsigned"} , np .dtype (np .typecodes ["UnsignedInteger" ][0 ])),
461
461
],
462
462
)
463
463
def test_downcast_basic (data , kwargs , exp_dtype ):
0 commit comments