1515 ]
1616}
1717
18- expected_non_alphabetic = {
19- "a" : [
20- "E.T. Phone Home" ,
21- "They'Re Bill'S Friends From The Uk" ,
22- "To Infinity,And Beyond!" ,
23- "With123Numbers" ,
24- "__Dunder__Score_A1_.2B ?Three" ,
25- ]
26- }
27- expected_non_alphanumeric = {
28- "a" : [
29- "E.T. Phone Home" ,
30- "They'Re Bill'S Friends From The Uk" ,
31- "To Infinity,And Beyond!" ,
32- "With123numbers" ,
33- "__Dunder__Score_A1_.2b ?Three" ,
34- ]
35- }
36-
37- NON_ALPHANUMERIC_BACKENDS = ("duckdb" , "polars" , "pyspark" )
18+ expected = {"a" : [s .title () for s in data ["a" ]]}
3819
3920
4021def test_str_to_titlecase_expr (
@@ -47,25 +28,13 @@ def test_str_to_titlecase_expr(
4728 if "ibis" in str (constructor ):
4829 request .applymarker (pytest .mark .xfail )
4930
50- expected = (
51- expected_non_alphanumeric
52- if any (x in str (constructor ) for x in NON_ALPHANUMERIC_BACKENDS )
53- else expected_non_alphabetic
54- )
55-
5631 df = nw .from_native (constructor (data ))
5732 result_frame = df .select (nw .col ("a" ).str .to_titlecase ())
5833
5934 assert_equal_data (result_frame , expected )
6035
6136
6237def test_str_to_titlecase_series (constructor_eager : ConstructorEager ) -> None :
63- expected = (
64- expected_non_alphanumeric
65- if any (x in str (constructor_eager ) for x in NON_ALPHANUMERIC_BACKENDS )
66- else expected_non_alphabetic
67- )
68-
6938 df = nw .from_native (constructor_eager (data ), eager_only = True )
7039 result_series = df ["a" ].str .to_titlecase ()
7140
0 commit comments