@@ -230,10 +230,11 @@ async def test_get_text_file_contents(jp_fetch, contents, path, name):
230
230
)
231
231
assert expected_http_error (e , 400 )
232
232
233
+
233
234
@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled retrieving hidden files on Windows" )
234
235
async def test_get_404_hidden (jp_fetch , contents , contents_dir ):
235
236
# Create text files
236
- hidden_dir = contents_dir / ' .hidden'
237
+ hidden_dir = contents_dir / " .hidden"
237
238
hidden_dir .mkdir (parents = True , exist_ok = True )
238
239
txt = f"visible text file in hidden dir"
239
240
txtname = hidden_dir .joinpath (f"visible.txt" )
@@ -242,7 +243,7 @@ async def test_get_404_hidden(jp_fetch, contents, contents_dir):
242
243
txt2 = f"hidden text file"
243
244
txtname2 = contents_dir .joinpath (f".hidden.txt" )
244
245
txtname2 .write_text (txt2 , encoding = "utf-8" )
245
-
246
+
246
247
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
247
248
await jp_fetch (
248
249
"api" ,
@@ -261,6 +262,7 @@ async def test_get_404_hidden(jp_fetch, contents, contents_dir):
261
262
)
262
263
assert expected_http_error (e , 404 )
263
264
265
+
264
266
@pytest .mark .parametrize ("path,name" , dirs )
265
267
async def test_get_binary_file_contents (jp_fetch , contents , path , name ):
266
268
blobname = name + ".blob"
@@ -441,48 +443,38 @@ async def test_upload_txt(jp_fetch, contents, contents_dir, _check_created):
441
443
@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled uploading hidden files on Windows" )
442
444
async def test_upload_txt_hidden (jp_fetch , contents , contents_dir ):
443
445
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
444
- body = ' ünicode téxt'
446
+ body = " ünicode téxt"
445
447
model = {
446
- ' content' : body ,
447
- ' format' : ' text' ,
448
- ' type' : ' file' ,
448
+ " content" : body ,
449
+ " format" : " text" ,
450
+ " type" : " file" ,
449
451
}
450
- path = ' .hidden/Upload tést.txt'
452
+ path = " .hidden/Upload tést.txt"
451
453
await jp_fetch ("api" , "contents" , path , method = "PUT" , body = json .dumps (model ))
452
454
assert expected_http_error (e , 400 )
453
455
454
456
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"
463
460
await jp_fetch ("api" , "contents" , path , method = "PUT" , body = json .dumps (model ))
464
461
assert expected_http_error (e , 400 )
465
462
466
463
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
467
- body = ' ünicode téxt'
464
+ body = " ünicode téxt"
468
465
model = {
469
- ' content' : body ,
470
- ' format' : ' text' ,
471
- ' type' : ' file' ,
466
+ " content" : body ,
467
+ " format" : " text" ,
468
+ " type" : " file" ,
472
469
}
473
- path = ' .hidden.txt'
470
+ path = " .hidden.txt"
474
471
await jp_fetch ("api" , "contents" , path , method = "PUT" , body = json .dumps (model ))
475
472
assert expected_http_error (e , 400 )
476
473
477
474
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"
486
478
await jp_fetch ("api" , "contents" , path , method = "PUT" , body = json .dumps (model ))
487
479
assert expected_http_error (e , 400 )
488
480
@@ -581,7 +573,11 @@ async def test_copy_put_400(jp_fetch, contents, contents_dir, _check_created):
581
573
582
574
583
575
@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
+ ):
585
581
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
586
582
await jp_fetch (
587
583
"api" ,
@@ -591,7 +587,7 @@ async def test_copy_put_400_hidden(jp_fetch, contents, contents_dir,):
591
587
body = json .dumps ({"copy_from" : "new.txt" }),
592
588
)
593
589
assert expected_http_error (e , 400 )
594
-
590
+
595
591
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
596
592
await jp_fetch (
597
593
"api" ,
@@ -601,7 +597,7 @@ async def test_copy_put_400_hidden(jp_fetch, contents, contents_dir,):
601
597
body = json .dumps ({"copy_from" : ".hidden/new.txt" }),
602
598
)
603
599
assert expected_http_error (e , 400 )
604
-
600
+
605
601
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
606
602
await jp_fetch (
607
603
"api" ,
@@ -611,7 +607,7 @@ async def test_copy_put_400_hidden(jp_fetch, contents, contents_dir,):
611
607
body = json .dumps ({"copy_from" : "new.txt" }),
612
608
)
613
609
assert expected_http_error (e , 400 )
614
-
610
+
615
611
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
616
612
await jp_fetch (
617
613
"api" ,
@@ -636,16 +632,20 @@ async def test_copy_dir_400(jp_fetch, contents, contents_dir, _check_created):
636
632
637
633
638
634
@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
+ ):
640
640
641
641
# Create text files
642
- hidden_dir = contents_dir / ' .hidden'
642
+ hidden_dir = contents_dir / " .hidden"
643
643
hidden_dir .mkdir (parents = True , exist_ok = True )
644
644
txt = f"visible text file in hidden dir"
645
645
txtname = hidden_dir .joinpath (f"new.txt" )
646
646
txtname .write_text (txt , encoding = "utf-8" )
647
647
648
- paths = [' new.txt' , ' .hidden.txt' ]
648
+ paths = [" new.txt" , " .hidden.txt" ]
649
649
for name in paths :
650
650
txt = f"{ name } text file"
651
651
txtname = contents_dir .joinpath (f"{ name } .txt" )
@@ -660,7 +660,7 @@ async def test_copy_400_hidden(jp_fetch, contents, contents_dir,):
660
660
body = json .dumps ({"copy_from" : "new.txt" }),
661
661
)
662
662
assert expected_http_error (e , 400 )
663
-
663
+
664
664
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
665
665
await jp_fetch (
666
666
"api" ,
@@ -689,7 +689,7 @@ async def test_copy_400_hidden(jp_fetch, contents, contents_dir,):
689
689
method = "POST" ,
690
690
body = json .dumps ({"copy_from" : ".hidden.txt" }),
691
691
)
692
- assert expected_http_error (e , 400 )
692
+ assert expected_http_error (e , 400 )
693
693
694
694
695
695
@pytest .mark .parametrize ("path,name" , dirs )
@@ -729,20 +729,22 @@ async def test_delete_non_empty_dir(jp_fetch, contents):
729
729
await jp_fetch ("api" , "contents" , "å b" , method = "GET" )
730
730
assert expected_http_error (e , 404 )
731
731
732
+
732
733
@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled deleting hidden dirs on Windows" )
733
734
async def test_delete_hidden_dir (jp_fetch , contents ):
734
735
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
735
736
await jp_fetch ("api" , "contents" , ".hidden" , method = "DELETE" )
736
737
assert expected_http_error (e , 400 )
737
738
739
+
738
740
@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled deleting hidden dirs on Windows" )
739
741
async def test_delete_hidden_file (jp_fetch , contents ):
740
- #Test deleting file in a hidden directory
742
+ # Test deleting file in a hidden directory
741
743
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
742
744
await jp_fetch ("api" , "contents" , ".hidden/test.txt" , method = "DELETE" )
743
745
assert expected_http_error (e , 400 )
744
746
745
- #Test deleting a hidden file
747
+ # Test deleting a hidden file
746
748
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
747
749
await jp_fetch ("api" , "contents" , ".hidden.txt" , method = "DELETE" )
748
750
assert expected_http_error (e , 400 )
@@ -778,11 +780,12 @@ async def test_rename(jp_fetch, jp_base_url, contents, contents_dir):
778
780
assert "z.ipynb" in nbnames
779
781
assert "a.ipynb" not in nbnames
780
782
783
+
781
784
@pytest .mark .skipif (sys .platform == "win32" , reason = "Disabled copying hidden files on Windows" )
782
785
async def test_rename_400_hidden (jp_fetch , jp_base_url , contents , contents_dir ):
783
786
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"
786
789
# Rename the file
787
790
r = await jp_fetch (
788
791
"api" ,
@@ -792,10 +795,10 @@ async def test_rename_400_hidden(jp_fetch, jp_base_url, contents, contents_dir):
792
795
body = json .dumps ({"path" : new_path }),
793
796
)
794
797
assert expected_http_error (e , 400 )
795
-
798
+
796
799
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"
799
802
# Rename the file
800
803
r = await jp_fetch (
801
804
"api" ,
@@ -805,10 +808,10 @@ async def test_rename_400_hidden(jp_fetch, jp_base_url, contents, contents_dir):
805
808
body = json .dumps ({"path" : new_path }),
806
809
)
807
810
assert expected_http_error (e , 400 )
808
-
811
+
809
812
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"
812
815
# Rename the file
813
816
r = await jp_fetch (
814
817
"api" ,
@@ -820,8 +823,8 @@ async def test_rename_400_hidden(jp_fetch, jp_base_url, contents, contents_dir):
820
823
assert expected_http_error (e , 400 )
821
824
822
825
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"
825
828
# Rename the file
826
829
r = await jp_fetch (
827
830
"api" ,
0 commit comments