@@ -724,3 +724,99 @@ def test_match_keyword_exact(archivers, request):
724724 assert "k3" in out
725725 assert "k2" not in out
726726 assert "k1" not in out
727+
728+
729+ # ISO week-date and ordinal-date support tests
730+
731+
732+ def test_match_iso_week (archivers , request ):
733+ """
734+ Test matching archives by ISO week number (YYYY-Www).
735+ Week 10 of 2025 runs from 2025-03-03 to 2025-03-09 inclusive.
736+ """
737+ archiver = request .getfixturevalue (archivers )
738+ cmd (archiver , "repo-create" , RK_ENCRYPTION )
739+ WEEK10_ARCHIVES = [
740+ ("iso-week-before" , "2025-03-02T23:59:59" ),
741+ ("iso-week-start" , "2025-03-03T00:00:00" ),
742+ ("iso-week-mid" , "2025-03-05T12:00:00" ),
743+ ("iso-week-end" , "2025-03-09T23:59:59" ),
744+ ("iso-week-after" , "2025-03-10T00:00:00" ),
745+ ]
746+ for name , ts in WEEK10_ARCHIVES :
747+ create_src_archive (archiver , name , ts = ts )
748+
749+ out = cmd (archiver , "repo-list" , "-v" , "--match-archives=date:2025-W10" , exit_code = 0 )
750+ assert "iso-week-before" not in out
751+ assert "iso-week-start" in out
752+ assert "iso-week-mid" in out
753+ assert "iso-week-end" in out
754+ assert "iso-week-after" not in out
755+
756+
757+ def test_match_iso_weekday (archivers , request ):
758+ """
759+ Test matching archives by ISO week and weekday (YYYY-Www-D).
760+ Week 10 Day 3 of 2025 is Wednesday 2025-03-05.
761+ """
762+ archiver = request .getfixturevalue (archivers )
763+ cmd (archiver , "repo-create" , RK_ENCRYPTION )
764+ WEEKDAY_ARCHIVES = [
765+ ("iso-wed" , "2025-03-05T08:00:00" ),
766+ ("iso-tue" , "2025-03-04T12:00:00" ),
767+ ("iso-thu" , "2025-03-06T18:00:00" ),
768+ ]
769+ for name , ts in WEEKDAY_ARCHIVES :
770+ create_src_archive (archiver , name , ts = ts )
771+
772+ out = cmd (archiver , "repo-list" , "-v" , "--match-archives=date:2025-W10-3" , exit_code = 0 )
773+ assert "iso-wed" in out
774+ assert "iso-tue" not in out
775+ assert "iso-thu" not in out
776+
777+
778+ def test_match_ordinal_date (archivers , request ):
779+ """
780+ Test matching archives by ordinal day of year (YYYY-DDD).
781+ Day 032 of 2025 is 2025-02-01.
782+ """
783+ archiver = request .getfixturevalue (archivers )
784+ cmd (archiver , "repo-create" , RK_ENCRYPTION )
785+ ORDINAL_ARCHIVES = [
786+ ("ord-jan31" , "2025-01-31T23:59:59" ), # day 031
787+ ("ord-feb1" , "2025-02-01T00:00:00" ), # day 032
788+ ("ord-feb1-end" , "2025-02-01T23:59:59" ),
789+ ("ord-feb2" , "2025-02-02T00:00:00" ), # day 033
790+ ]
791+ for name , ts in ORDINAL_ARCHIVES :
792+ create_src_archive (archiver , name , ts = ts )
793+
794+ out = cmd (archiver , "repo-list" , "-v" , "--match-archives=date:2025-032" , exit_code = 0 )
795+ assert "ord-jan31" not in out
796+ assert "ord-feb1" in out
797+ assert "ord-feb1-end" in out
798+ assert "ord-feb2" not in out
799+
800+
801+ def test_match_rfc3339 (archivers , request ):
802+ """
803+ Test matching archives by RFC 3339 date format (use ' ' as delimiter rather than 'T').
804+ """
805+ archiver = request .getfixturevalue (archivers )
806+ cmd (archiver , "repo-create" , RK_ENCRYPTION )
807+ RFC_ARCHIVES = [
808+ ("rfc-start" , "2025-01-01T00:00:00Z" ),
809+ ("rfc-mid" , "2025-01-01T12:00:00Z" ),
810+ ("rfc-max" , "2025-01-01T23:59:59Z" ),
811+ ("rfc-after" , "2025-01-02T00:00:00Z" ),
812+ ]
813+ for name , ts in RFC_ARCHIVES :
814+ create_src_archive (archiver , name , ts = ts )
815+
816+ out = cmd (
817+ archiver , "repo-list" , "-v" , "--match-archives=date:2025-01-01 00:00:00Z/2025-01-02 00:00:00Z" , exit_code = 0
818+ )
819+ assert "rfc-start" in out
820+ assert "rfc-mid" in out
821+ assert "rfc-max" in out
822+ assert "rfc-after" not in out
0 commit comments