diff options
author | Seth Morton <seth.m.morton@gmail.com> | 2020-11-18 08:45:53 -0800 |
---|---|---|
committer | Seth Morton <seth.m.morton@gmail.com> | 2020-11-18 08:45:53 -0800 |
commit | e0d1415b7c1bb43d4f4495d39bed8a5c2db4a2fa (patch) | |
tree | 56881c51237fad2e259208622b522bfff73a7b26 | |
parent | 18c76a733e8d8f3e924ee8adc2d670703a7c7682 (diff) | |
download | natsort-windows-exporer-sorting.tar.gz |
Improve testing clarity and maintainablilitywindows-exporer-sorting
-rw-r--r-- | tests/test_os_sorted.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/tests/test_os_sorted.py b/tests/test_os_sorted.py index 2c38d9c..afb15cf 100644 --- a/tests/test_os_sorted.py +++ b/tests/test_os_sorted.py @@ -41,15 +41,26 @@ def test_os_sorted_misc_no_fail(): def test_os_sorted_key(): - given = expected = ["foo0", "goo1", "foo2"] + given = ["foo0", "foo2", "goo1"] + expected = ["foo0", "goo1", "foo2"] result = natsort.os_sorted(given, key=lambda x: x.replace("g", "f")) assert result == expected # The following is a master list of things that might give trouble # when sorting like the file explorer. -given = [ +given_characters = [ "11111", + "aaaaa", + "foo0", + "foo_0", + "foo1", + "foo2", + "foo4", + "foo10", + "Foo3", +] +given_special = [ "!", "#", "$", @@ -71,9 +82,6 @@ given = [ "^", "_", "`", - "aaaaa", - "foo0", - "foo_0", "{", "}", "~", @@ -82,15 +90,11 @@ given = [ "´", "µ", "€", - "foo1", - "foo2", - "foo4", - "foo10", - "Foo3", ] # The expceted values change based on the environment if platform.system() == "Windows": + given = given_characters + given_special expected = [ "'", "-", @@ -133,6 +137,7 @@ if platform.system() == "Windows": ] elif has_icu: + given = given_characters + given_special expected = [ "_", "-", @@ -179,7 +184,7 @@ else: # It's not really possible to predict the order across all # the different OS. To work around this, we will exclude # the special characters from the sort. - given = given[0:1] + given[22:25] + given[33:] + given = given_characters expected = [ "11111", "aaaaa", |