diff --git a/test/t/unit/test_unit_expand_glob.py b/test/t/unit/test_unit_expand_glob.py index 7c1bcde3f9c..480fd37d0a8 100644 --- a/test/t/unit/test_unit_expand_glob.py +++ b/test/t/unit/test_unit_expand_glob.py @@ -1,8 +1,18 @@ +import unicodedata + import pytest from conftest import assert_bash_exec, bash_env_saved +def normalize(string): + # Applies "canonical decomposition", so might make errors look weird? + # The alternative is probably `NFC` which composes together some of + # the characters again. + # See https://docs.python.org/3/library/unicodedata.html#unicodedata.normalize + return unicodedata.normalize("NFD", string) + + @pytest.mark.bashcomp( cmd=None, cwd="_filedir", @@ -22,14 +32,15 @@ def functions(self, bash): def test_match_all(self, bash, functions): output = assert_bash_exec(bash, "__tester '*'", want_output=True) - assert ( - output.strip() - == "" + assert normalize(output.strip()) == normalize( + "" ) def test_match_pattern(self, bash, functions): output = assert_bash_exec(bash, "__tester 'a*'", want_output=True) - assert output.strip() == "" + assert normalize(output.strip()) == normalize( + "" + ) def test_match_unmatched(self, bash, functions): output = assert_bash_exec( @@ -51,7 +62,9 @@ def test_protect_from_noglob(self, bash, functions): with bash_env_saved(bash, functions) as bash_env: bash_env.set("noglob", True) output = assert_bash_exec(bash, "__tester 'a*'", want_output=True) - assert output.strip() == "" + assert normalize(output.strip()) == normalize( + "" + ) def test_protect_from_failglob(self, bash, functions): with bash_env_saved(bash) as bash_env: @@ -83,4 +96,6 @@ def test_protect_from_GLOBIGNORE(self, bash, functions): bash_env.save_shopt("dotglob") bash_env.write_variable("GLOBIGNORE", "*") output = assert_bash_exec(bash, "__tester 'a*'", want_output=True) - assert output.strip() == "" + assert normalize(output.strip()) == normalize( + "" + )