diff options
author | Gilthans <gilthans@gmail.com> | 2022-08-11 12:02:15 +0300 |
---|---|---|
committer | Gilthans <gilthans@gmail.com> | 2022-08-11 12:02:15 +0300 |
commit | 16f430a5daf0ab31acaad1dfdab09d2cdbae25ca (patch) | |
tree | d1e4612fb9d39106d4555ac9f6a87dc0e0830bf5 /tests | |
parent | e3c32f5638bf3a0e9a23633495269bea0e75d379 (diff) | |
download | natsort-16f430a5daf0ab31acaad1dfdab09d2cdbae25ca.tar.gz |
Treat paths as strings in StrParser
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_natsorted.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_natsorted.py b/tests/test_natsorted.py index eb3aefe..1cbed83 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,11 @@ 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", [ |