11import io
22
3- from databricks .sdk .workspace .v2 .workspace import ImportFormat , Language
4- from databricks .sdk .workspace .v2 .client import WorkspaceClient
53from databricks .sdk .iam .v2 .client import CurrentUserClient
4+ from databricks .sdk .workspace .v2 .client import WorkspaceClient
5+ from databricks .sdk .workspace .v2 .workspace import ImportFormat , Language
6+
67
78def test_workspace_recursive_list (w , workspace_dir , random ):
89 wc = WorkspaceClient (config = w )
@@ -25,9 +26,9 @@ def test_workspace_recursive_list(w, workspace_dir, random):
2526def test_workspace_upload_download_notebooks (w , random ):
2627 wc = WorkspaceClient (config = w )
2728 cuc = CurrentUserClient (config = w )
28-
29+
2930 notebook = f"/Users/{ cuc .me ().user_name } /notebook-{ random (12 )} .py"
30-
31+
3132 wc .upload (notebook , io .BytesIO (b"print(1)" ))
3233 with wc .download (notebook ) as f :
3334 content = f .read ()
@@ -39,7 +40,7 @@ def test_workspace_upload_download_notebooks(w, random):
3940def test_workspace_unzip_notebooks (w , random ):
4041 wc = WorkspaceClient (config = w )
4142 cuc = CurrentUserClient (config = w )
42-
43+
4344 notebook = f"/Users/{ cuc .me ().user_name } /notebook-{ random (12 )} .py"
4445
4546 # Big notebooks can be gzipped during transfer by the API (out of our control)
@@ -58,7 +59,7 @@ def test_workspace_unzip_notebooks(w, random):
5859def test_workspace_download_connection_closed (w , random ):
5960 wc = WorkspaceClient (config = w )
6061 cuc = CurrentUserClient (config = w )
61-
62+
6263 notebook = f"/Users/{ cuc .me ().user_name } /notebook-{ random (12 )} .py"
6364
6465 wc .upload (notebook , io .BytesIO (b"print(1)" ))
@@ -74,7 +75,7 @@ def test_workspace_download_connection_closed(w, random):
7475def test_workspace_upload_download_files (w , random ):
7576 wc = WorkspaceClient (config = w )
7677 cuc = CurrentUserClient (config = w )
77-
78+
7879 py_file = f"/Users/{ cuc .me ().user_name } /file-{ random (12 )} .py"
7980
8081 wc .upload (py_file , io .BytesIO (b"print(1)" ), format = ImportFormat .AUTO )
@@ -88,7 +89,7 @@ def test_workspace_upload_download_files(w, random):
8889def test_workspace_upload_download_txt_files (w , random ):
8990 wc = WorkspaceClient (config = w )
9091 cuc = CurrentUserClient (config = w )
91-
92+
9293 txt_file = f"/Users/{ cuc .me ().user_name } /txt-{ random (12 )} .txt"
9394
9495 wc .upload (txt_file , io .BytesIO (b"print(1)" ), format = ImportFormat .AUTO )
@@ -102,7 +103,7 @@ def test_workspace_upload_download_txt_files(w, random):
102103def test_workspace_upload_download_notebooks_no_extension (w , random ):
103104 wc = WorkspaceClient (config = w )
104105 cuc = CurrentUserClient (config = w )
105-
106+
106107 nb = f"/Users/{ cuc .me ().user_name } /notebook-{ random (12 )} "
107108
108109 wc .upload (
0 commit comments