From 2eb7ae2337dd39de2fd971be3e3696780b35579b Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Fri, 27 Dec 2024 21:20:47 +0100 Subject: [PATCH] fmt --- py-polars/polars/expr/string.py | 6 +++--- py-polars/polars/series/string.py | 2 +- .../unit/operations/namespaces/string/test_string.py | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/py-polars/polars/expr/string.py b/py-polars/polars/expr/string.py index 4cc579e0f347..8653e775aa3d 100644 --- a/py-polars/polars/expr/string.py +++ b/py-polars/polars/expr/string.py @@ -2940,8 +2940,8 @@ def normalize(self, form: UnicodeForm = "NFC") -> Expr: -------- >>> df = pl.DataFrame({"text": ["01²", "KADOKAWA"]}) >>> new = df.with_columns( - ... nfc = pl.col("text").str.normalize("NFC"), - ... nfkc = pl.col("text").str.normalize("NFKC") + ... nfc=pl.col("text").str.normalize("NFC"), + ... nfkc=pl.col("text").str.normalize("NFKC"), ... ) >>> new shape: (2, 3) @@ -2963,7 +2963,7 @@ def normalize(self, form: UnicodeForm = "NFC") -> Expr: │ 4 ┆ 4 ┆ 3 │ │ 24 ┆ 24 ┆ 8 │ └──────┴─────┴──────┘ - """ # noqa: RUF002 + """ # noqa: RUF002 return wrap_expr(self._pyexpr.str_normalize(form)) diff --git a/py-polars/polars/series/string.py b/py-polars/polars/series/string.py index ab7f45dd8b55..faa7d02b0e62 100644 --- a/py-polars/polars/series/string.py +++ b/py-polars/polars/series/string.py @@ -2259,4 +2259,4 @@ def normalize(self, form: UnicodeForm = "NFC") -> Series: "012" "KADOKAWA" ] - """ # noqa: RUF002 + """ # noqa: RUF002 diff --git a/py-polars/tests/unit/operations/namespaces/string/test_string.py b/py-polars/tests/unit/operations/namespaces/string/test_string.py index f8484117cf23..62cae2f968ea 100644 --- a/py-polars/tests/unit/operations/namespaces/string/test_string.py +++ b/py-polars/tests/unit/operations/namespaces/string/test_string.py @@ -1848,23 +1848,23 @@ def test_escape_regex() -> None: assert_frame_equal(result_df, expected_df) assert_series_equal(result_df["escaped"], expected_df["escaped"]) + @pytest.mark.parametrize( ("form", "expected_data"), [ - ("NFC", ["01²", "KADOKAWA"]), # noqa: RUF001 - ("NFD", ["01²", "KADOKAWA"]), # noqa: RUF001 + ("NFC", ["01²", "KADOKAWA"]), # noqa: RUF001 + ("NFD", ["01²", "KADOKAWA"]), # noqa: RUF001 ("NFKC", ["012", "KADOKAWA"]), ("NFKD", ["012", "KADOKAWA"]), ], ) -def test_string_normalize( - form: str, expected_data: list[str | None] -) -> None: - s = pl.Series(["01²", "KADOKAWA"], dtype=pl.String) # noqa: RUF001 +def test_string_normalize(form: str, expected_data: list[str | None]) -> None: + s = pl.Series(["01²", "KADOKAWA"], dtype=pl.String) # noqa: RUF001 res = s.str.normalize(form) expected_s = pl.Series(expected_data, dtype=pl.String) assert_series_equal(res, expected_s) + def test_string_normalize_wrong_input() -> None: with pytest.raises(ValueError, match="`form` must be one of"): pl.Series(["01²"], dtype=pl.String).str.normalize("foobar")