@@ -230,10 +230,11 @@ async def test_get_text_file_contents(jp_fetch, contents, path, name):
230230 )
231231 assert expected_http_error (e , 400 )
232232
233+
233234@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled retrieving hidden files on Windows" )
234235async def test_get_404_hidden (jp_fetch , contents , contents_dir ):
235236 # Create text files
236- hidden_dir = contents_dir / ' .hidden'
237+ hidden_dir = contents_dir / " .hidden"
237238 hidden_dir .mkdir (parents = True , exist_ok = True )
238239 txt = f"visible text file in hidden dir"
239240 txtname = hidden_dir .joinpath (f"visible.txt" )
@@ -242,7 +243,7 @@ async def test_get_404_hidden(jp_fetch, contents, contents_dir):
242243 txt2 = f"hidden text file"
243244 txtname2 = contents_dir .joinpath (f".hidden.txt" )
244245 txtname2 .write_text (txt2 , encoding = "utf-8" )
245-
246+
246247 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
247248 await jp_fetch (
248249 "api" ,
@@ -261,6 +262,7 @@ async def test_get_404_hidden(jp_fetch, contents, contents_dir):
261262 )
262263 assert expected_http_error (e , 404 )
263264
265+
264266@pytest .mark .parametrize ("path,name" , dirs )
265267async def test_get_binary_file_contents (jp_fetch , contents , path , name ):
266268 blobname = name + ".blob"
@@ -441,48 +443,38 @@ async def test_upload_txt(jp_fetch, contents, contents_dir, _check_created):
441443@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled uploading hidden files on Windows" )
442444async def test_upload_txt_hidden (jp_fetch , contents , contents_dir ):
443445 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
444- body = ' ünicode téxt'
446+ body = " ünicode téxt"
445447 model = {
446- ' content' : body ,
447- ' format' : ' text' ,
448- ' type' : ' file' ,
448+ " content" : body ,
449+ " format" : " text" ,
450+ " type" : " file" ,
449451 }
450- path = ' .hidden/Upload tést.txt'
452+ path = " .hidden/Upload tést.txt"
451453 await jp_fetch ("api" , "contents" , path , method = "PUT" , body = json .dumps (model ))
452454 assert expected_http_error (e , 400 )
453455
454456 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
455- body = 'ünicode téxt'
456- model = {
457- 'content' : body ,
458- 'format' : 'text' ,
459- 'type' : 'file' ,
460- 'path' : '.hidden/test.txt'
461- }
462- path = 'Upload tést.txt'
457+ body = "ünicode téxt"
458+ model = {"content" : body , "format" : "text" , "type" : "file" , "path" : ".hidden/test.txt" }
459+ path = "Upload tést.txt"
463460 await jp_fetch ("api" , "contents" , path , method = "PUT" , body = json .dumps (model ))
464461 assert expected_http_error (e , 400 )
465462
466463 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
467- body = ' ünicode téxt'
464+ body = " ünicode téxt"
468465 model = {
469- ' content' : body ,
470- ' format' : ' text' ,
471- ' type' : ' file' ,
466+ " content" : body ,
467+ " format" : " text" ,
468+ " type" : " file" ,
472469 }
473- path = ' .hidden.txt'
470+ path = " .hidden.txt"
474471 await jp_fetch ("api" , "contents" , path , method = "PUT" , body = json .dumps (model ))
475472 assert expected_http_error (e , 400 )
476473
477474 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
478- body = 'ünicode téxt'
479- model = {
480- 'content' : body ,
481- 'format' : 'text' ,
482- 'type' : 'file' ,
483- 'path' : '.hidden.txt'
484- }
485- path = 'Upload tést.txt'
475+ body = "ünicode téxt"
476+ model = {"content" : body , "format" : "text" , "type" : "file" , "path" : ".hidden.txt" }
477+ path = "Upload tést.txt"
486478 await jp_fetch ("api" , "contents" , path , method = "PUT" , body = json .dumps (model ))
487479 assert expected_http_error (e , 400 )
488480
@@ -581,7 +573,11 @@ async def test_copy_put_400(jp_fetch, contents, contents_dir, _check_created):
581573
582574
583575@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled copying hidden files on Windows" )
584- async def test_copy_put_400_hidden (jp_fetch , contents , contents_dir ,):
576+ async def test_copy_put_400_hidden (
577+ jp_fetch ,
578+ contents ,
579+ contents_dir ,
580+ ):
585581 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
586582 await jp_fetch (
587583 "api" ,
@@ -591,7 +587,7 @@ async def test_copy_put_400_hidden(jp_fetch, contents, contents_dir,):
591587 body = json .dumps ({"copy_from" : "new.txt" }),
592588 )
593589 assert expected_http_error (e , 400 )
594-
590+
595591 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
596592 await jp_fetch (
597593 "api" ,
@@ -601,7 +597,7 @@ async def test_copy_put_400_hidden(jp_fetch, contents, contents_dir,):
601597 body = json .dumps ({"copy_from" : ".hidden/new.txt" }),
602598 )
603599 assert expected_http_error (e , 400 )
604-
600+
605601 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
606602 await jp_fetch (
607603 "api" ,
@@ -611,7 +607,7 @@ async def test_copy_put_400_hidden(jp_fetch, contents, contents_dir,):
611607 body = json .dumps ({"copy_from" : "new.txt" }),
612608 )
613609 assert expected_http_error (e , 400 )
614-
610+
615611 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
616612 await jp_fetch (
617613 "api" ,
@@ -636,16 +632,20 @@ async def test_copy_dir_400(jp_fetch, contents, contents_dir, _check_created):
636632
637633
638634@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled copying hidden files on Windows" )
639- async def test_copy_400_hidden (jp_fetch , contents , contents_dir ,):
635+ async def test_copy_400_hidden (
636+ jp_fetch ,
637+ contents ,
638+ contents_dir ,
639+ ):
640640
641641 # Create text files
642- hidden_dir = contents_dir / ' .hidden'
642+ hidden_dir = contents_dir / " .hidden"
643643 hidden_dir .mkdir (parents = True , exist_ok = True )
644644 txt = f"visible text file in hidden dir"
645645 txtname = hidden_dir .joinpath (f"new.txt" )
646646 txtname .write_text (txt , encoding = "utf-8" )
647647
648- paths = [' new.txt' , ' .hidden.txt' ]
648+ paths = [" new.txt" , " .hidden.txt" ]
649649 for name in paths :
650650 txt = f"{ name } text file"
651651 txtname = contents_dir .joinpath (f"{ name } .txt" )
@@ -660,7 +660,7 @@ async def test_copy_400_hidden(jp_fetch, contents, contents_dir,):
660660 body = json .dumps ({"copy_from" : "new.txt" }),
661661 )
662662 assert expected_http_error (e , 400 )
663-
663+
664664 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
665665 await jp_fetch (
666666 "api" ,
@@ -689,7 +689,7 @@ async def test_copy_400_hidden(jp_fetch, contents, contents_dir,):
689689 method = "POST" ,
690690 body = json .dumps ({"copy_from" : ".hidden.txt" }),
691691 )
692- assert expected_http_error (e , 400 )
692+ assert expected_http_error (e , 400 )
693693
694694
695695@pytest .mark .parametrize ("path,name" , dirs )
@@ -729,20 +729,22 @@ async def test_delete_non_empty_dir(jp_fetch, contents):
729729 await jp_fetch ("api" , "contents" , "å b" , method = "GET" )
730730 assert expected_http_error (e , 404 )
731731
732+
732733@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled deleting hidden dirs on Windows" )
733734async def test_delete_hidden_dir (jp_fetch , contents ):
734735 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
735736 await jp_fetch ("api" , "contents" , ".hidden" , method = "DELETE" )
736737 assert expected_http_error (e , 400 )
737738
739+
738740@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled deleting hidden dirs on Windows" )
739741async def test_delete_hidden_file (jp_fetch , contents ):
740- #Test deleting file in a hidden directory
742+ # Test deleting file in a hidden directory
741743 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
742744 await jp_fetch ("api" , "contents" , ".hidden/test.txt" , method = "DELETE" )
743745 assert expected_http_error (e , 400 )
744746
745- #Test deleting a hidden file
747+ # Test deleting a hidden file
746748 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
747749 await jp_fetch ("api" , "contents" , ".hidden.txt" , method = "DELETE" )
748750 assert expected_http_error (e , 400 )
@@ -778,11 +780,12 @@ async def test_rename(jp_fetch, jp_base_url, contents, contents_dir):
778780 assert "z.ipynb" in nbnames
779781 assert "a.ipynb" not in nbnames
780782
783+
781784@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled copying hidden files on Windows" )
782785async def test_rename_400_hidden (jp_fetch , jp_base_url , contents , contents_dir ):
783786 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
784- old_path = ' .hidden/old.txt'
785- new_path = ' new.txt'
787+ old_path = " .hidden/old.txt"
788+ new_path = " new.txt"
786789 # Rename the file
787790 r = await jp_fetch (
788791 "api" ,
@@ -792,10 +795,10 @@ async def test_rename_400_hidden(jp_fetch, jp_base_url, contents, contents_dir):
792795 body = json .dumps ({"path" : new_path }),
793796 )
794797 assert expected_http_error (e , 400 )
795-
798+
796799 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
797- old_path = ' old.txt'
798- new_path = ' .hidden/new.txt'
800+ old_path = " old.txt"
801+ new_path = " .hidden/new.txt"
799802 # Rename the file
800803 r = await jp_fetch (
801804 "api" ,
@@ -805,10 +808,10 @@ async def test_rename_400_hidden(jp_fetch, jp_base_url, contents, contents_dir):
805808 body = json .dumps ({"path" : new_path }),
806809 )
807810 assert expected_http_error (e , 400 )
808-
811+
809812 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
810- old_path = ' .hidden.txt'
811- new_path = ' new.txt'
813+ old_path = " .hidden.txt"
814+ new_path = " new.txt"
812815 # Rename the file
813816 r = await jp_fetch (
814817 "api" ,
@@ -820,8 +823,8 @@ async def test_rename_400_hidden(jp_fetch, jp_base_url, contents, contents_dir):
820823 assert expected_http_error (e , 400 )
821824
822825 with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
823- old_path = ' old.txt'
824- new_path = ' .hidden.txt'
826+ old_path = " old.txt"
827+ new_path = " .hidden.txt"
825828 # Rename the file
826829 r = await jp_fetch (
827830 "api" ,
0 commit comments