A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: test_file_manager assertions (#2207)
Akshay Agrawal620f0fc2e8a0
diff --git a/tests/_server/test_file_manager.py b/tests/_server/test_file_manager.pyindex 839d26f7ec..b06060900e 100644--- a/tests/_server/test_file_manager.py+++ b/tests/_server/test_file_manager.py@@ -1,6 +1,7 @@from __future__ import annotationsimport os+import sysimport tempfilefrom typing import Generator@@ -68,7 +69,7 @@ def test_rename_to_existing_filename(app_file_manager: AppFileManager) -> None:try:with pytest.raises(HTTPException) as e: # noqa: PT012app_file_manager.rename(existing_filename)- assert e.value == HTTPStatus.BAD_REQUEST+ assert e.value.status_code == HTTPStatus.BAD_REQUESTfinally:os.remove(existing_filename)@@ -91,7 +92,7 @@ def test_rename_exception(app_file_manager: AppFileManager) -> None:new_filename = "/invalid/path/new_filename.py"with pytest.raises(HTTPException) as e: # noqa: PT012app_file_manager.rename(new_filename)- assert e.value.status_code == HTTPStatus.SERVER_ERROR+ assert e.value.status_code == HTTPStatus.SERVER_ERRORdef test_rename_create_new_file(app_file_manager: AppFileManager) -> None:@@ -153,11 +154,15 @@ def test_save_app_config_valid(app_file_manager: AppFileManager) -> None:os.remove(app_file_manager.filename)+ condition=sys.platform == "win32",+ reason="filename is not invalid on Windows",+)def test_save_app_config_exception(app_file_manager: AppFileManager) -> None:app_file_manager.filename = "/invalid/path/app_config.py"with pytest.raises(HTTPException) as e: # noqa: PT012app_file_manager.save_app_config({})- assert e.value.status_code == HTTPStatus.SERVER_ERROR+ assert e.value.status_code == HTTPStatus.SERVER_ERRORdef test_save_filename_change_not_allowed(@@ -167,7 +172,7 @@ def test_save_filename_change_not_allowed(save_request.filename = "new.py"with pytest.raises(HTTPException) as e: # noqa: PT012app_file_manager.save(save_request)- assert e.value.status_code == HTTPStatus.BAD_REQUEST+ assert e.value.status_code == HTTPStatus.BAD_REQUESTdef test_save_existing_filename(app_file_manager: AppFileManager) -> None:@@ -178,7 +183,7 @@ def test_save_existing_filename(app_file_manager: AppFileManager) -> None:try:with pytest.raises(HTTPException) as e: # noqa: PT012app_file_manager.save(save_request)- assert e.value.status_code == HTTPStatus.BAD_REQUEST+ assert e.value.status_code == HTTPStatus.BAD_REQUESTfinally:os.remove(existing_filename)