@@ -2157,11 +2157,14 @@ def test_encode_native_str(self):
21572157 result = df .select (f .encode (column ("a" ), "base64" ).alias ("e" )).collect ()
21582158 assert result [0 ].column (0 )[0 ].as_py () == "aGVsbG8"
21592159
2160- def test_date_part_native_str_no_deprecation_warning (self ):
2160+ def test_date_part_native_str (self ):
2161+ ctx = SessionContext ()
2162+ df = ctx .from_pydict ({"a" : ["2021-07-15T00:00:00" ]})
2163+ df = df .select (f .to_timestamp (column ("a" )).alias ("a" ))
21612164 with warnings .catch_warnings ():
21622165 warnings .simplefilter ("error" , DeprecationWarning )
2163- expr = f .date_part ("year" , column ("a" ))
2164- assert expr is not None
2166+ result = df . select ( f .date_part ("year" , column ("a" )). alias ( "y" )). collect ( )
2167+ assert result [ 0 ]. column ( 0 )[ 0 ]. as_py () == 2021
21652168
21662169 @pytest .mark .parametrize (
21672170 ("func" , "name" ),
@@ -2179,11 +2182,14 @@ def test_date_part_expr_part_warns_deprecated(self, func, name):
21792182 expr = func (literal ("year" ), column ("a" ))
21802183 assert expr is not None
21812184
2182- def test_date_trunc_native_str_no_deprecation_warning (self ):
2185+ def test_date_trunc_native_str (self ):
2186+ ctx = SessionContext ()
2187+ df = ctx .from_pydict ({"a" : ["2021-07-15T12:34:56" ]})
2188+ df = df .select (f .to_timestamp (column ("a" )).alias ("a" ))
21832189 with warnings .catch_warnings ():
21842190 warnings .simplefilter ("error" , DeprecationWarning )
2185- expr = f .date_trunc ("month" , column ("a" ))
2186- assert expr is not None
2191+ result = df . select ( f .date_trunc ("month" , column ("a" )). alias ( "t" )). collect ( )
2192+ assert str ( result [ 0 ]. column ( 0 )[ 0 ]. as_py ()) == "2021-07-01 00:00:00"
21872193
21882194 @pytest .mark .parametrize (
21892195 ("func" , "name" ),
0 commit comments