@@ -278,6 +278,7 @@ def test_exception_invalid_win_char(self, value, platform):
278278 for reserved_keyword , platform in product (
279279 WIN_RESERVED_FILE_NAMES , ["windows" , "universal" ]
280280 )
281+ if reserved_keyword not in ["." , ".." ]
281282 ]
282283 + [
283284 ["/foo/abc/{}.txt" .format (reserved_keyword ), platform , ReservedNameError ]
@@ -336,23 +337,23 @@ class Test_sanitize_filepath(object):
336337 @pytest .mark .parametrize (
337338 ["platform" , "value" , "replace_text" , "expected" ],
338339 [
339- ["universal" , "A " + c + "B" , rep , "A " + rep + "B" ]
340+ ["universal" , "AA " + c + "B" , rep , "AA " + rep + "B" ]
340341 for c , rep in product (SANITIZE_CHARS , REPLACE_TEXT_LIST )
341342 ]
342343 + [
343- ["universal" , "A " + c + "B" , rep , "A " + c + "B" ]
344+ ["universal" , "AA " + c + "B" , rep , "AA " + c + "B" ]
344345 for c , rep in product (NOT_SANITIZE_CHARS , REPLACE_TEXT_LIST )
345346 ]
346347 + [
347348 ["universal" , "あ" + c + "い" , rep , "あ" + c + "い" ]
348349 for c , rep in product (NOT_SANITIZE_CHARS , REPLACE_TEXT_LIST )
349350 ]
350351 + [
351- ["linux" , "A " + c + "B" , rep , "A " + rep + "B" ]
352+ ["linux" , "AA " + c + "B" , rep , "AA " + rep + "B" ]
352353 for c , rep in product (INVALID_PATH_CHARS + unprintable_ascii_chars , REPLACE_TEXT_LIST )
353354 ]
354355 + [
355- ["linux" , "A " + c + "B" , rep , "A " + c + "B" ]
356+ ["linux" , "AA " + c + "B" , rep , "AA " + c + "B" ]
356357 for c , rep in product ([":" , "*" , "?" , '"' , "<" , ">" , "|" ], REPLACE_TEXT_LIST )
357358 ],
358359 )
@@ -371,9 +372,16 @@ def test_normal_str(self, platform, value, replace_text, expected):
371372 platform ,
372373 "/abc/{}_/xyz" .format (reserved_keyword ),
373374 ]
374- for reserved_keyword , platform in product (
375- WIN_RESERVED_FILE_NAMES , ["windows" , "universal" ]
376- )
375+ for reserved_keyword , platform in product (WIN_RESERVED_FILE_NAMES , ["universal" ])
376+ if reserved_keyword not in ["." , ".." ]
377+ ]
378+ + [
379+ [
380+ "/abc/{}/xyz" .format (reserved_keyword ),
381+ platform ,
382+ "/abc/{}/xyz" .format (reserved_keyword ),
383+ ]
384+ for reserved_keyword , platform in product (WIN_RESERVED_FILE_NAMES , ["linux" ])
377385 if reserved_keyword not in ["." , ".." ]
378386 ]
379387 + [
@@ -382,9 +390,34 @@ def test_normal_str(self, platform, value, replace_text, expected):
382390 platform ,
383391 "/abc/{}_.txt" .format (reserved_keyword ),
384392 ]
385- for reserved_keyword , platform in product (
386- WIN_RESERVED_FILE_NAMES , ["windows" , "universal" ]
387- )
393+ for reserved_keyword , platform in product (WIN_RESERVED_FILE_NAMES , ["universal" ])
394+ if reserved_keyword not in ["." , ".." ]
395+ ]
396+ + [
397+ [
398+ "/abc/{}.txt" .format (reserved_keyword ),
399+ platform ,
400+ "/abc/{}.txt" .format (reserved_keyword ),
401+ ]
402+ for reserved_keyword , platform in product (WIN_RESERVED_FILE_NAMES , ["linux" ])
403+ if reserved_keyword not in ["." , ".." ]
404+ ]
405+ + [
406+ [
407+ "C:\\ abc\\ {}.txt" .format (reserved_keyword ),
408+ platform ,
409+ "C:/abc/{}_.txt" .format (reserved_keyword ),
410+ ]
411+ for reserved_keyword , platform in product (WIN_RESERVED_FILE_NAMES , ["universal" ])
412+ if reserved_keyword not in ["." , ".." ]
413+ ]
414+ + [
415+ [
416+ "C:\\ abc\\ {}.txt" .format (reserved_keyword ),
417+ platform ,
418+ "C:\\ abc\\ {}_.txt" .format (reserved_keyword ),
419+ ]
420+ for reserved_keyword , platform in product (WIN_RESERVED_FILE_NAMES , ["windows" ])
388421 if reserved_keyword not in ["." , ".." ]
389422 ],
390423 )
@@ -397,11 +430,11 @@ def test_normal_reserved_name(self, value, test_platform, expected):
397430 @pytest .mark .parametrize (
398431 ["value" , "replace_text" , "expected" ],
399432 [
400- [Path ("A " + c + "B" ), rep , Path ("A " + rep + "B" )]
433+ [Path ("AA " + c + "B" ), rep , Path ("AA " + rep + "B" )]
401434 for c , rep in product (SANITIZE_CHARS , REPLACE_TEXT_LIST )
402435 ]
403436 + [
404- [Path ("A " + c + "B" ), rep , Path ("A " + c + "B" )]
437+ [Path ("AA " + c + "B" ), rep , Path ("AA " + c + "B" )]
405438 for c , rep in product (NOT_SANITIZE_CHARS , REPLACE_TEXT_LIST )
406439 ]
407440 + [
0 commit comments