@@ -3886,7 +3886,7 @@ def test_date_time_astype_int(
38863886
38873887
38883888def test_string_astype_int (session ):
3889- pd_series = pd .Series (["4" , "-7" , "0" , " -03" ])
3889+ pd_series = pd .Series (["4" , "-7" , "0" , "-03" ])
38903890 bf_series = series .Series (pd_series , session = session )
38913891
38923892 pd_result = pd_series .astype ("Int64" )
@@ -3897,7 +3897,7 @@ def test_string_astype_int(session):
38973897
38983898def test_string_astype_float (session ):
38993899 pd_series = pd .Series (
3900- ["1" , "-1" , "-0" , "000" , " -03.235" , "naN" , "-inf" , "INf" , ".33" , "7.235e-8" ]
3900+ ["1" , "-1" , "-0" , "000" , "-03.235" , "naN" , "-inf" , "INf" , ".33" , "7.235e-8" ]
39013901 )
39023902
39033903 bf_series = series .Series (pd_series , session = session )
@@ -3908,7 +3908,7 @@ def test_string_astype_float(session):
39083908 pd .testing .assert_series_equal (bf_result , pd_result , check_index_type = False )
39093909
39103910
3911- def test_string_astype_date ():
3911+ def test_string_astype_date (session ):
39123912 if int (pa .__version__ .split ("." )[0 ]) < 15 :
39133913 pytest .skip (
39143914 "Avoid pyarrow.lib.ArrowNotImplementedError: "
@@ -3919,7 +3919,7 @@ def test_string_astype_date():
39193919 pd .ArrowDtype (pa .string ())
39203920 )
39213921
3922- bf_series = series .Series (pd_series )
3922+ bf_series = series .Series (pd_series , session = session )
39233923
39243924 # TODO(b/340885567): fix type error
39253925 pd_result = pd_series .astype ("date32[day][pyarrow]" ) # type: ignore
@@ -3928,20 +3928,20 @@ def test_string_astype_date():
39283928 pd .testing .assert_series_equal (bf_result , pd_result , check_index_type = False )
39293929
39303930
3931- def test_string_astype_datetime ():
3931+ def test_string_astype_datetime (session ):
39323932 pd_series = pd .Series (
39333933 ["2014-08-15 08:15:12" , "2015-08-15 08:15:12.654754" , "2016-02-29 00:00:00" ]
39343934 ).astype (pd .ArrowDtype (pa .string ()))
39353935
3936- bf_series = series .Series (pd_series )
3936+ bf_series = series .Series (pd_series , session = session )
39373937
39383938 pd_result = pd_series .astype (pd .ArrowDtype (pa .timestamp ("us" )))
39393939 bf_result = bf_series .astype (pd .ArrowDtype (pa .timestamp ("us" ))).to_pandas ()
39403940
39413941 pd .testing .assert_series_equal (bf_result , pd_result , check_index_type = False )
39423942
39433943
3944- def test_string_astype_timestamp ():
3944+ def test_string_astype_timestamp (session ):
39453945 pd_series = pd .Series (
39463946 [
39473947 "2014-08-15 08:15:12+00:00" ,
@@ -3950,7 +3950,7 @@ def test_string_astype_timestamp():
39503950 ]
39513951 ).astype (pd .ArrowDtype (pa .string ()))
39523952
3953- bf_series = series .Series (pd_series )
3953+ bf_series = series .Series (pd_series , session = session )
39543954
39553955 pd_result = pd_series .astype (pd .ArrowDtype (pa .timestamp ("us" , tz = "UTC" )))
39563956 bf_result = bf_series .astype (
@@ -3986,9 +3986,9 @@ def test_timestamp_astype_string(session):
39863986
39873987
39883988@pytest .mark .parametrize ("errors" , ["raise" , "null" ])
3989- def test_float_astype_json (errors ):
3989+ def test_float_astype_json (errors , session ):
39903990 data = ["1.25" , "2500000000" , None , "-12323.24" ]
3991- bf_series = series .Series (data , dtype = dtypes .FLOAT_DTYPE )
3991+ bf_series = series .Series (data , dtype = dtypes .FLOAT_DTYPE , session = session )
39923992
39933993 bf_result = bf_series .astype (dtypes .JSON_DTYPE , errors = errors )
39943994 assert bf_result .dtype == dtypes .JSON_DTYPE
@@ -3998,9 +3998,9 @@ def test_float_astype_json(errors):
39983998 pd .testing .assert_series_equal (bf_result .to_pandas (), expected_result )
39993999
40004000
4001- def test_float_astype_json_str ():
4001+ def test_float_astype_json_str (session ):
40024002 data = ["1.25" , "2500000000" , None , "-12323.24" ]
4003- bf_series = series .Series (data , dtype = dtypes .FLOAT_DTYPE )
4003+ bf_series = series .Series (data , dtype = dtypes .FLOAT_DTYPE , session = session )
40044004
40054005 bf_result = bf_series .astype ("json" )
40064006 assert bf_result .dtype == dtypes .JSON_DTYPE
@@ -4011,14 +4011,14 @@ def test_float_astype_json_str():
40114011
40124012
40134013@pytest .mark .parametrize ("errors" , ["raise" , "null" ])
4014- def test_string_astype_json (errors ):
4014+ def test_string_astype_json (errors , session ):
40154015 data = [
40164016 "1" ,
40174017 None ,
40184018 '["1","3","5"]' ,
40194019 '{"a":1,"b":["x","y"],"c":{"x":[],"z":false}}' ,
40204020 ]
4021- bf_series = series .Series (data , dtype = dtypes .STRING_DTYPE )
4021+ bf_series = series .Series (data , dtype = dtypes .STRING_DTYPE , session = session )
40224022
40234023 bf_result = bf_series .astype (dtypes .JSON_DTYPE , errors = errors )
40244024 assert bf_result .dtype == dtypes .JSON_DTYPE
@@ -4027,9 +4027,9 @@ def test_string_astype_json(errors):
40274027 pd .testing .assert_series_equal (bf_result .to_pandas (), pd_result )
40284028
40294029
4030- def test_string_astype_json_in_safe_mode ():
4030+ def test_string_astype_json_in_safe_mode (session ):
40314031 data = ["this is not a valid json string" ]
4032- bf_series = series .Series (data , dtype = dtypes .STRING_DTYPE )
4032+ bf_series = series .Series (data , dtype = dtypes .STRING_DTYPE , session = session )
40334033 bf_result = bf_series .astype (dtypes .JSON_DTYPE , errors = "null" )
40344034 assert bf_result .dtype == dtypes .JSON_DTYPE
40354035
@@ -4038,9 +4038,9 @@ def test_string_astype_json_in_safe_mode():
40384038 pd .testing .assert_series_equal (bf_result .to_pandas (), expected )
40394039
40404040
4041- def test_string_astype_json_raise_error ():
4041+ def test_string_astype_json_raise_error (session ):
40424042 data = ["this is not a valid json string" ]
4043- bf_series = series .Series (data , dtype = dtypes .STRING_DTYPE )
4043+ bf_series = series .Series (data , dtype = dtypes .STRING_DTYPE , session = session )
40444044 with pytest .raises (
40454045 google .api_core .exceptions .BadRequest ,
40464046 match = "syntax error while parsing value" ,
@@ -4064,8 +4064,8 @@ def test_string_astype_json_raise_error():
40644064 ),
40654065 ],
40664066)
4067- def test_json_astype_others (data , to_type , errors ):
4068- bf_series = series .Series (data , dtype = dtypes .JSON_DTYPE )
4067+ def test_json_astype_others (data , to_type , errors , session ):
4068+ bf_series = series .Series (data , dtype = dtypes .JSON_DTYPE , session = session )
40694069
40704070 bf_result = bf_series .astype (to_type , errors = errors )
40714071 assert bf_result .dtype == to_type
@@ -4085,8 +4085,8 @@ def test_json_astype_others(data, to_type, errors):
40854085 pytest .param (["true" , None ], dtypes .STRING_DTYPE , id = "to_string" ),
40864086 ],
40874087)
4088- def test_json_astype_others_raise_error (data , to_type ):
4089- bf_series = series .Series (data , dtype = dtypes .JSON_DTYPE )
4088+ def test_json_astype_others_raise_error (data , to_type , session ):
4089+ bf_series = series .Series (data , dtype = dtypes .JSON_DTYPE , session = session )
40904090 with pytest .raises (google .api_core .exceptions .BadRequest ):
40914091 bf_series .astype (to_type , errors = "raise" ).to_pandas ()
40924092
@@ -4415,8 +4415,8 @@ def test_query_job_setters(scalars_dfs):
44154415 ([1 , 1 , 1 , 1 , 1 ],),
44164416 ],
44174417)
4418- def test_is_monotonic_increasing (series_input ):
4419- scalars_df = series .Series (series_input , dtype = pd .Int64Dtype ())
4418+ def test_is_monotonic_increasing (series_input , session ):
4419+ scalars_df = series .Series (series_input , dtype = pd .Int64Dtype (), session = session )
44204420 scalars_pandas_df = pd .Series (series_input , dtype = pd .Int64Dtype ())
44214421 assert (
44224422 scalars_df .is_monotonic_increasing == scalars_pandas_df .is_monotonic_increasing
@@ -4434,8 +4434,8 @@ def test_is_monotonic_increasing(series_input):
44344434 ([1 , 1 , 1 , 1 , 1 ],),
44354435 ],
44364436)
4437- def test_is_monotonic_decreasing (series_input ):
4438- scalars_df = series .Series (series_input )
4437+ def test_is_monotonic_decreasing (series_input , session ):
4438+ scalars_df = series .Series (series_input , session = session )
44394439 scalars_pandas_df = pd .Series (series_input )
44404440 assert (
44414441 scalars_df .is_monotonic_decreasing == scalars_pandas_df .is_monotonic_decreasing
0 commit comments