summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2017-01-24 06:27:07 +0100
committernfnty <git@nfnty.se>2017-01-24 06:27:07 +0100
commit009973f7f4b650aa20109e67edae673faf4f25f4 (patch)
tree7dd239d0db5cb4da131b22ca9b6e0c47fe48b9de /tests
parentc5f776edfa1fe1ddf8027a6acec7b1caee8e9867 (diff)
downloadranger-009973f7f4b650aa20109e67edae673faf4f25f4.tar.gz
container.fsobject: Fix natural sort
Fixes #749
Diffstat (limited to 'tests')
-rw-r--r--tests/ranger/container/test_fsobject.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/tests/ranger/container/test_fsobject.py b/tests/ranger/container/test_fsobject.py
index 2c6a693f..d2c9a770 100644
--- a/tests/ranger/container/test_fsobject.py
+++ b/tests/ranger/container/test_fsobject.py
@@ -21,15 +21,34 @@ def create_filesystem_object(path):
 
 def test_basename_natural1():
     """Test filenames without extensions."""
-    fsos = [create_filesystem_object(path)
-            for path in ("hello", "hello1", "hello2")]
+    fsos = [
+        create_filesystem_object(path)
+        for path in (
+            "0", "1", "2", "3",
+            "10", "11", "12", "13",
+            "100", "101", "102", "103",
+            "110", "111", "112", "113",
+            "hello",
+            "hello1", "hello2",
+            "hello11", "hello12",
+            "hello100", "hello101", "hello111", "hello112",
+        )
+    ]
     assert fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural"))
     assert fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural_lower"))
 
 
 def test_basename_natural2():
     """Test filenames with extensions."""
-    fsos = [create_filesystem_object(path)
-            for path in ("hello", "hello.txt", "hello1.txt", "hello2.txt")]
+    fsos = [
+        create_filesystem_object(path)
+        for path in (
+            "hello", "hello.txt",
+            "hello0.txt", "hello1.txt", "hello2.txt", "hello3.txt"
+            "hello10.txt", "hello11.txt", "hello12.txt", "hello13.txt"
+            "hello100.txt", "hello101.txt", "hello102.txt", "hello103.txt"
+            "hello110.txt", "hello111.txt", "hello112.txt", "hello113.txt"
+        )
+    ]
     assert fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural"))
     assert fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural_lower"))