From 6f90013357f9d32c713a7ca91f2cd383162cd0ae Mon Sep 17 00:00:00 2001 From: Nathan Hattersley Date: Fri, 7 Jun 2024 00:42:40 +0000 Subject: [PATCH] fix regression for title case names --- src/polish_names.jl | 2 +- test/test_polish_names.jl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/polish_names.jl b/src/polish_names.jl index cd21d01..e646ed3 100644 --- a/src/polish_names.jl +++ b/src/polish_names.jl @@ -81,7 +81,7 @@ end function _preprocess_name(name) preprocessed = normalize(String(name); stripmark=true) - matched = match(r"^[[:upper:]]+|\%|\#$", preprocessed) + matched = match(r"^[[:upper:]\%\#\s]+$", preprocessed) if matched !== nothing preprocessed = lowercase(preprocessed) end diff --git a/test/test_polish_names.jl b/test/test_polish_names.jl index 463763e..bf1b45f 100644 --- a/test/test_polish_names.jl +++ b/test/test_polish_names.jl @@ -8,6 +8,7 @@ using DataFrames: DataFrame " _aName with_loTsOfProblems1" => [4, 5, 6], " _aName with_loTsOfProblems2" => [7, 8, 9], " _aNameABC with_loTsOfProblemsDEF" => [10, 11, 12], + "ImTitleCase" => [13, 14, 15], ) testCT = CleanTable(testDF) @@ -16,6 +17,7 @@ using DataFrames: DataFrame :a_name_with_lo_ts_of_problems1, :a_name_with_lo_ts_of_problems2, :a_name_abc_with_lo_ts_of_problems_def, + :im_title_case, ]) @test names(polish_names!(testCT; style=:camelCase)) == Vector{Symbol}([ @@ -23,6 +25,7 @@ using DataFrames: DataFrame :aNameWithLoTsOfProblems1, :aNameWithLoTsOfProblems2, :aNameAbcWithLoTsOfProblemsDef, + :imTitleCase, ]) @test polish_names(testDF) isa CleanTable