Skip to content

Commit c8f9969

Browse files
committed
Add test for sort_paths
1 parent 14d8f96 commit c8f9969

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

domdf_python_tools/paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
import sys
5252
import tempfile
5353
from collections import defaultdict, deque
54-
from typing import Dict, IO, Any, Callable, ContextManager, Iterable, Iterator, List, Optional, TypeVar, Union
54+
from typing import IO, Any, Callable, ContextManager, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
5555

5656
# this package
5757
from domdf_python_tools.compat import nullcontext

tests/test_paths.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
copytree,
3030
in_directory,
3131
matchglob,
32+
sort_paths,
3233
traverse_to_file
3334
)
3435
from domdf_python_tools.testing import not_pypy, not_windows
@@ -856,3 +857,16 @@ def test_temporarypathplus():
856857
assert t.name.exists()
857858
assert t.name.is_dir()
858859
t.cleanup()
860+
861+
862+
def test_sort_paths():
863+
paths = ["foo.txt", "bar.toml", "bar.py", "baz.yaml", "fizz/buzz.c", "fizz/buzz.h"]
864+
expected = [
865+
PathPlus("fizz/buzz.c"),
866+
PathPlus("fizz/buzz.h"),
867+
PathPlus("bar.py"),
868+
PathPlus("bar.toml"),
869+
PathPlus("baz.yaml"),
870+
PathPlus("foo.txt"),
871+
]
872+
assert sort_paths(*paths) == expected

0 commit comments

Comments
 (0)