Skip to content

Commit

Permalink
fix regression for title case names (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
nateybear authored Jun 10, 2024
1 parent 08e5d95 commit b11380e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/polish_names.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/test_polish_names.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -16,13 +17,15 @@ 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}([
:aNameWithLoTsOfProblems,
:aNameWithLoTsOfProblems1,
:aNameWithLoTsOfProblems2,
:aNameAbcWithLoTsOfProblemsDef,
:imTitleCase,
])

@test polish_names(testDF) isa CleanTable
Expand Down

0 comments on commit b11380e

Please sign in to comment.