From 1c2cb066d59d932bc5cc521f7b412f1b7fcbc9ce Mon Sep 17 00:00:00 2001 From: David Schultz Date: Fri, 12 Jan 2024 12:31:37 -0600 Subject: [PATCH] also test album sorting with negative numbers --- src/sigal/gallery.py | 2 +- tests/sample/pictures/dir1/test2/index.md | 3 ++- tests/test_gallery.py | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sigal/gallery.py b/src/sigal/gallery.py index 539e217..f9eefa0 100644 --- a/src/sigal/gallery.py +++ b/src/sigal/gallery.py @@ -515,7 +515,7 @@ class Album: continue return "" - key = natsort_keygen(key=sort_key, alg=ns.LOCALE) + key = natsort_keygen(key=sort_key, alg=ns.SIGNED|ns.LOCALE) self.subdirs.sort(key=key, reverse=reverse) signals.albums_sorted.send(self) diff --git a/tests/sample/pictures/dir1/test2/index.md b/tests/sample/pictures/dir1/test2/index.md index 576d6c7..7920a50 100644 --- a/tests/sample/pictures/dir1/test2/index.md +++ b/tests/sample/pictures/dir1/test2/index.md @@ -1 +1,2 @@ -Order: 01 +Order: -10 +PartialOrder: 01 diff --git a/tests/test_gallery.py b/tests/test_gallery.py index 211c161..e33e017 100644 --- a/tests/test_gallery.py +++ b/tests/test_gallery.py @@ -234,8 +234,7 @@ def test_albums_sort(settings): a.sort_subdirs("title") assert [im.title for im in a.albums] == list(reversed(titles)) - orders = ["01", "02", "03"] - orders.sort() + orders = ["-10", "02", "03"] settings["albums_sort_reverse"] = False a = Album("dir1", settings, album["subdirs"], album["medias"], gal) a.sort_subdirs("meta.order")