structly validation

This commit is contained in:
Maxim Devaev
2023-03-06 04:18:38 +02:00
parent 5495f70564
commit 7667834b6d
5 changed files with 21 additions and 31 deletions

View File

@@ -86,18 +86,10 @@ def test_fail__valid_abs_path__dir(arg: Any) -> None:
("dsl-4.11.rc1.iso", "dsl-4.11.rc1.iso"),
("systemrescuecd-x86-5.3.1.iso", "systemrescuecd-x86-5.3.1.iso"),
("ubuntu-16.04.5-desktop-i386.iso", "ubuntu-16.04.5-desktop-i386.iso"),
(" тест(){}[ \t].iso\t", "тест(){}[ _].iso"),
("\n" + "x" * 1000, "x" * 255),
("test", "test"),
("test test [test] #test$", "test test [test] #test$"),
(".test", ".test"),
("..test", "..test"),
("..тест..", "..тест.."),
("..те\\ст..", "..те\\ст.."),
(".....", "....."),
(".....txt", ".....txt"),
(" .. .", ".. ."),
("..\n.", ".._."),
(" тест(){}[ \t].iso\t", "тест(){}[ _].iso"),
("\n" + "x" * 1000, "x" * 255),
("test", "test"),
("test test [test] #test$", "test test [test] #test$"),
])
def test_ok__valid_printable_filename(arg: Any, retval: str) -> None:
assert valid_printable_filename(arg) == retval
@@ -110,6 +102,7 @@ def test_ok__valid_printable_filename(arg: Any, retval: str) -> None:
"test/",
"/test",
"../test",
".test",
"./.",
"../.",
"./..",
@@ -117,6 +110,7 @@ def test_ok__valid_printable_filename(arg: Any, retval: str) -> None:
"/ ..",
".. /",
"/.. /",
"lost+found",
"",
" ",
None,