summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSeth Morton <seth.m.morton@gmail.com>2022-08-29 08:05:58 -0700
committerGitHub <noreply@github.com>2022-08-29 08:05:58 -0700
commite5d2e4507728e53d1867ac87e169fca1d251d8cf (patch)
treebf4177617984e286483caeb9a7cc7d9d69ba3806 /tests
parente3c32f5638bf3a0e9a23633495269bea0e75d379 (diff)
parente4f8cd2254cbb500e5ab9eb38aae94f863d261ad (diff)
downloadnatsort-e5d2e4507728e53d1867ac87e169fca1d251d8cf.tar.gz
Merge pull request #153 from Gilthans/master
Treat paths as strings in StrParser
Diffstat (limited to 'tests')
-rw-r--r--tests/test_natsorted.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_natsorted.py b/tests/test_natsorted.py
index eb3aefe..eccb9d2 100644
--- a/tests/test_natsorted.py
+++ b/tests/test_natsorted.py
@@ -5,6 +5,7 @@ See the README or the natsort homepage for more details.
"""
from operator import itemgetter
+from pathlib import PurePosixPath
from typing import List, Tuple, Union
import pytest
@@ -84,6 +85,15 @@ def test_natsorted_can_sort_as_version_numbers() -> None:
assert natsorted(given) == expected
+def test_natsorted_can_sorts_paths_same_as_strings() -> None:
+ paths = [
+ PurePosixPath("a/1/something"),
+ PurePosixPath("a/2/something"),
+ PurePosixPath("a/10/something"),
+ ]
+ assert [str(p) for p in natsorted(paths)] == natsorted([str(p) for p in paths])
+
+
@pytest.mark.parametrize(
"alg, expected",
[