Skip to content

Commit

Permalink
slight tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl authored Mar 7, 2024
1 parent c33102b commit 47e8401
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions shtab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ def complete2pattern(opt_complete, shell: str, choice_type2fn) -> str:


def wordify(string: str) -> str:
r"""Replace non-word chars [\W] with underscores [_]"""
return re.sub(r"\W", "_", string)
"""Replace non-word chars [\\W] with underscores [_]"""
return re.sub("\\W", "_", string)


def get_public_subcommands(sub):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_shtab.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ def test_subparser_slashes(shell, caplog):
shell.compgen('-W "${_shtab_test_pos_0_choices[*]}"', "s", "sub/cmd")
shell.test('-z "${_shtab_test_COMPGEN-}"')
elif shell == "zsh":
# make sure the slash was properly substituted to avoid syntax errors
assert "_shtab_test_sub/cmd" not in completion
assert "_shtab_test_sub_cmd" in completion


@fix_shell
Expand Down

0 comments on commit 47e8401

Please sign in to comment.