summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSeth Morton <seth.m.morton@gmail.com>2020-11-17 22:54:38 -0800
committerSeth Morton <seth.m.morton@gmail.com>2020-11-17 22:54:38 -0800
commitcde07bbcb24a95b5ef5b5796ab870020b9b8a163 (patch)
treedaa8ade4332bc6f0039c493da8760be84df1d771 /tests
parentd69a5414f111b9584f28c17382af1821c5e291fb (diff)
downloadnatsort-cde07bbcb24a95b5ef5b5796ab870020b9b8a163.tar.gz
Add a test for key with os_sorted
Diffstat (limited to 'tests')
-rw-r--r--tests/test_os_sorted.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_os_sorted.py b/tests/test_os_sorted.py
index aaaffac..2c38d9c 100644
--- a/tests/test_os_sorted.py
+++ b/tests/test_os_sorted.py
@@ -40,6 +40,12 @@ def test_os_sorted_misc_no_fail():
natsort.os_sorted([9, 4.3, None, float("nan")])
+def test_os_sorted_key():
+ given = 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 = [