فهرست منبع

fix: revert to allow _set_frame to has frame as t.Optional[FrameType]

trgiangdo 1 سال پیش
والد
کامیت
42dc9c24e5
65فایلهای تغییر یافته به همراه129 افزوده شده و 254 حذف شده
  1. 1 1
      taipy/gui/gui.py
  2. 1 2
      tests/gui/actions/test_download.py
  3. 1 2
      tests/gui/actions/test_get_state_id.py
  4. 1 2
      tests/gui/actions/test_hold_control.py
  5. 1 2
      tests/gui/actions/test_invoke_callback.py
  6. 1 2
      tests/gui/actions/test_navigate.py
  7. 1 2
      tests/gui/actions/test_notify.py
  8. 1 2
      tests/gui/actions/test_resume_control.py
  9. 5 10
      tests/gui/builder/control/test_chart.py
  10. 3 6
      tests/gui/builder/control/test_dialog.py
  11. 2 4
      tests/gui/builder/control/test_input.py
  12. 2 4
      tests/gui/builder/control/test_slider.py
  13. 1 2
      tests/gui/builder/control/test_status.py
  14. 3 6
      tests/gui/builder/control/test_table.py
  15. 6 12
      tests/gui/control/test_chart.py
  16. 6 12
      tests/gui/control/test_dialog.py
  17. 5 10
      tests/gui/control/test_input.py
  18. 2 4
      tests/gui/control/test_slider.py
  19. 2 4
      tests/gui/control/test_status.py
  20. 5 10
      tests/gui/control/test_table.py
  21. 1 2
      tests/gui/data/test_pandas_data_accessor.py
  22. 1 2
      tests/gui/e2e/page_scopes/test_class_scopes_binding_global.py
  23. 1 2
      tests/gui/e2e/page_scopes/test_class_scopes_main_var_access.py
  24. 1 2
      tests/gui/e2e/page_scopes/test_page_scopes.py
  25. 1 2
      tests/gui/e2e/page_scopes/test_page_scopes_binding_global.py
  26. 1 2
      tests/gui/e2e/page_scopes/test_page_scopes_main_var_access.py
  27. 1 2
      tests/gui/e2e/page_scopes/test_page_scopes_state.py
  28. 2 4
      tests/gui/e2e/renderers/test_html_rendering.py
  29. 1 2
      tests/gui/e2e/renderers/test_markdown_rendering.py
  30. 2 4
      tests/gui/e2e/test_accessor_data_format.py
  31. 5 10
      tests/gui/e2e/test_margin.py
  32. 1 2
      tests/gui/e2e/test_navbar_navigate.py
  33. 1 2
      tests/gui/e2e/test_redirect.py
  34. 2 4
      tests/gui/e2e/test_theme.py
  35. 2 4
      tests/gui/e2e/test_timezone.py
  36. 1 2
      tests/gui/e2e/with_action/test_button_action.py
  37. 1 2
      tests/gui/e2e/with_action/test_dict.py
  38. 1 2
      tests/gui/e2e/with_action/test_selector_action.py
  39. 2 4
      tests/gui/e2e/with_action/test_slider_action.py
  40. 1 2
      tests/gui/e2e/with_action/test_slider_input_reload.py
  41. 2 4
      tests/gui/e2e/with_action/test_text_edit.py
  42. 7 14
      tests/gui/extension/test_library.py
  43. 5 10
      tests/gui/gui_specific/test_expression.py
  44. 1 2
      tests/gui/gui_specific/test_folder_pages_binding.py
  45. 4 8
      tests/gui/gui_specific/test_navigate.py
  46. 1 2
      tests/gui/gui_specific/test_render_route.py
  47. 1 2
      tests/gui/gui_specific/test_run_thread.py
  48. 1 2
      tests/gui/gui_specific/test_state.py
  49. 1 2
      tests/gui/ignore/no_file/test_ignore.py
  50. 2 4
      tests/gui/ignore/with_file/test_with_ignore.py
  51. 1 2
      tests/gui/long_runnig/test_long_running.py
  52. 1 2
      tests/gui/renderers/test_html_parsing.py
  53. 1 2
      tests/gui/server/http/test_file_upload.py
  54. 1 2
      tests/gui/server/http/test_status.py
  55. 2 4
      tests/gui/server/http/test_user_content.py
  56. 1 2
      tests/gui/server/ws/test_a.py
  57. 1 2
      tests/gui/server/ws/test_broadcast.py
  58. 1 2
      tests/gui/server/ws/test_df.py
  59. 1 2
      tests/gui/server/ws/test_du.py
  60. 2 4
      tests/gui/server/ws/test_on_change.py
  61. 1 2
      tests/gui/server/ws/test_ru.py
  62. 3 6
      tests/gui/server/ws/test_u.py
  63. 1 2
      tests/gui/server/ws/test_with.py
  64. 4 8
      tests/gui/utils/test_evaluator.py
  65. 4 5
      tests/gui/utils/test_map_dict.py

+ 1 - 1
taipy/gui/gui.py

@@ -1944,7 +1944,7 @@ class Gui:
             return self._server.get_flask()
         raise RuntimeError("get_flask_app() cannot be invoked before run() has been called.")
 
-    def _set_frame(self, frame: FrameType):
+    def _set_frame(self, frame: t.Optional[FrameType]):
         if not isinstance(frame, FrameType):  # pragma: no cover
             raise RuntimeError("frame must be a FrameType where Gui can collect the local variables.")
         self.__frame = frame

+ 1 - 2
tests/gui/actions/test_download.py

@@ -25,8 +25,7 @@ def test_download(gui: Gui, helpers):
         pass
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", Markdown("<|Hello {name}|button|id={btn_id}|>"))
     with patch("sys.argv", ["prog"]):

+ 1 - 2
tests/gui/actions/test_get_state_id.py

@@ -22,8 +22,7 @@ def test_get_state_id(gui: Gui, helpers):
     btn_id = "button1"  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", Markdown("<|Hello {name}|button|id={btn_id}|>"))
     with patch("sys.argv", ["prog"]):

+ 1 - 2
tests/gui/actions/test_hold_control.py

@@ -22,8 +22,7 @@ def test_hold_control(gui: Gui, helpers):
     btn_id = "button1"  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", Markdown("<|Hello {name}|button|id={btn_id}|>"))
     with patch("sys.argv", ["prog"]):

+ 1 - 2
tests/gui/actions/test_invoke_callback.py

@@ -27,8 +27,7 @@ def test_invoke_callback(gui: Gui, helpers):
         state.val = 10
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", Markdown("<|Hello {name}|button|id={btn_id}|>\n<|{val}|>"))
     with patch("sys.argv", ["prog"]):

+ 1 - 2
tests/gui/actions/test_navigate.py

@@ -22,8 +22,7 @@ def test_navigate(gui: Gui, helpers):
     btn_id = "button1"  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", Markdown("<|Hello {name}|button|id={btn_id}|>"))
     with patch("sys.argv", ["prog"]):

+ 1 - 2
tests/gui/actions/test_notify.py

@@ -22,8 +22,7 @@ def test_notify(gui: Gui, helpers):
     btn_id = "button1"  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", Markdown("<|Hello {name}|button|id={btn_id}|>"))
     with patch("sys.argv", ["prog"]):

+ 1 - 2
tests/gui/actions/test_resume_control.py

@@ -22,8 +22,7 @@ def test_resume_control(gui: Gui, helpers):
     btn_id = "button1"  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", Markdown("<|Hello {name}|button|id={btn_id}|>"))
     with patch("sys.argv", ["prog"]):

+ 5 - 10
tests/gui/builder/control/test_chart.py

@@ -58,8 +58,7 @@ def test_chart_builder_1(gui: Gui, helpers, csvdata):
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
         'width="100%"',
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_builder(gui, page, expected_list)
 
 
@@ -94,8 +93,7 @@ def test_chart_builder_2(gui: Gui, helpers, csvdata):
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
         'width="100%"',
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_builder(gui, page, expected_list)
 
 
@@ -173,8 +171,7 @@ def test_map_builder(gui: Gui, helpers):
             text="Globvalue",
             mode="markers",
         )
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     expected_list = [
         "<Chart",
         "&quot;Lat&quot;: &#x7B;&quot;index&quot;:",
@@ -210,8 +207,7 @@ def test_chart_indexed_properties_builder(gui: Gui, helpers):
             color=[None, "blue", "blue", None, "red", "red"],
         )
 
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     expected_list = [
         "<Chart",
         "&quot;traces&quot;: [[&quot;Date_str&quot;, &quot;La Rochelle&quot;], [&quot;Date_str&quot;, &quot;La Rochelle 1&quot;], [&quot;Date_str&quot;, &quot;La Rochelle 2&quot;], [&quot;Date_str&quot;, &quot;Montpellier&quot;], [&quot;Date_str&quot;, &quot;Montpellier 1&quot;], [&quot;Date_str&quot;, &quot;Montpellier 2&quot;]]",  # noqa: E501
@@ -255,8 +251,7 @@ def test_chart_indexed_properties_with_arrays_builder(gui: Gui, helpers):
             color="{colors}",
         )
 
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     expected_list = [
         "<Chart",
         "&quot;traces&quot;: [[&quot;Date_str&quot;, &quot;La Rochelle&quot;], [&quot;Date_str&quot;, &quot;La Rochelle 1&quot;], [&quot;Date_str&quot;, &quot;La Rochelle 2&quot;], [&quot;Date_str&quot;, &quot;Montpellier&quot;], [&quot;Date_str&quot;, &quot;Montpellier 1&quot;], [&quot;Date_str&quot;, &quot;Montpellier 2&quot;]]",  # noqa: E501

+ 3 - 6
tests/gui/builder/control/test_dialog.py

@@ -17,8 +17,7 @@ from taipy.gui import Gui, Markdown
 
 def test_dialog_builder_1(gui: Gui, helpers):
     dialog_open = False  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with tgb.Page(frame=None) as page:
         tgb.dialog(title="This is a Dialog", open="{dialog_open}", page="page_test", on_action="validate_action")  # type: ignore[attr-defined]
     expected_list = [
@@ -33,8 +32,7 @@ def test_dialog_builder_1(gui: Gui, helpers):
 
 
 def test_dialog_builder_2(gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     partial = gui.add_partial(Markdown("# A partial"))  # noqa: F841
     dialog_open = False  # noqa: F841
     with tgb.Page(frame=None) as page:
@@ -56,8 +54,7 @@ def test_dialog_builder_2(gui: Gui, helpers):
 
 
 def test_dialog_labels_builder(gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     dialog_open = False  # noqa: F841
     with tgb.Page(frame=None) as page:
         tgb.dialog(  # type: ignore[attr-defined]

+ 2 - 4
tests/gui/builder/control/test_input.py

@@ -17,8 +17,7 @@ from taipy.gui import Gui
 
 def test_input_builder(gui: Gui, helpers):
     x = "Hello World!"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with tgb.Page(frame=None) as page:
         tgb.input(value="{x}")  # type: ignore[attr-defined]
     expected_list = [
@@ -33,8 +32,7 @@ def test_input_builder(gui: Gui, helpers):
 
 def test_password_builder(gui: Gui, helpers):
     x = "Hello World!"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with tgb.Page(frame=None) as page:
         tgb.input(value="{x}", password=True)  # type: ignore[attr-defined]
     expected_list = [

+ 2 - 4
tests/gui/builder/control/test_slider.py

@@ -39,8 +39,7 @@ def test_slider_with_min_max_builder(gui: Gui, test_client, helpers):
 def test_slider_with_dict_labels_builder(gui: Gui, helpers):
     sel = "Item 1"  # noqa: F841
     labels = {"Item 1": "Label Start", "Item 3": "Label End"}  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with tgb.Page(frame=None) as page:
         tgb.slider(value="{sel}", lov="Item 1;Item 2;Item 3", labels=labels)  # type: ignore[attr-defined]
     expected_list = [
@@ -52,8 +51,7 @@ def test_slider_with_dict_labels_builder(gui: Gui, helpers):
 
 def test_slider_with_boolean_labels_builder(gui: Gui, helpers):
     sel = "Item 1"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with tgb.Page(frame=None) as page:
         tgb.slider(value="{sel}", lov="Item 1;Item 2;Item 3", labels=True)  # type: ignore[attr-defined]
     expected_list = ["<Slider", "labels={true}"]

+ 1 - 2
tests/gui/builder/control/test_status.py

@@ -24,6 +24,5 @@ def test_status_builder(gui: Gui, helpers):
         'defaultValue="[&#x7B;&quot;status&quot;: &quot;info&quot;, &quot;message&quot;: &quot;Info Message&quot;&#x7D;]"',  # noqa: E501
         "value={tpec_TpExPr_status_TPMDL_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_builder(gui, page, expected_list)

+ 3 - 6
tests/gui/builder/control/test_table.py

@@ -35,8 +35,7 @@ def test_table_builder_1(gui: Gui, helpers, csvdata):
         'updateVarName="_TpD_tpec_TpExPr_csvdata_TPMDL_0"',
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_builder(gui, page, expected_list)
 
 
@@ -62,8 +61,7 @@ def test_table_reset_builder(gui: Gui, helpers, csvdata):
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
         "columns={tp_TpExPr_gui_tbl_cols_True_None_7B_22columns_22_3A_20_22Day_3BEntity_3BCode_3BDaily_20hospital_20occupancy_22_2C_20_22date_format_22_3A_20_22eee_20dd_20MMM_20yyyy_22_7D_7B_22data_22_3A_20_22tpec_TpExPr_csvdata_TPMDL_0_22_7D_tpec_TpExPr_csvdata_TPMDL_0_csvdata_TPMDL_0_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_builder(gui, page, expected_list)
 
 
@@ -99,6 +97,5 @@ def test_table_builder_2(gui: Gui, helpers, csvdata):
         'updateVarName="_TpD_tpec_TpExPr_csvdata_TPMDL_0"',
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_builder(gui, page, expected_list)

+ 6 - 12
tests/gui/control/test_chart.py

@@ -35,8 +35,7 @@ def test_chart_md_1(gui: Gui, helpers, csvdata):
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
         'width="100%"',
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_md(gui, md_string, expected_list)
 
 
@@ -58,8 +57,7 @@ def test_chart_html_1(gui: Gui, helpers, csvdata):
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
         'width="100%"',
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_html(gui, html_string, expected_list)
 
 
@@ -81,8 +79,7 @@ def test_chart_html_2(gui: Gui, helpers, csvdata):
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
         'width="100%"',
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_html(gui, html_string, expected_list)
 
 
@@ -150,8 +147,7 @@ def test_map_md(gui: Gui, helpers):
         "margin": {"r": 0, "t": 0, "b": 0, "l": 0},
     }
     md = "<|{mapData}|chart|type=scattermapbox|marker={marker}|layout={layout}|lat=Lat|lon=Lon|text=Globvalue|mode=markers|>"  # noqa: E501
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     expected_list = [
         "<Chart",
         "&quot;Lat&quot;: &#x7B;&quot;index&quot;:",
@@ -179,8 +175,7 @@ def test_chart_indexed_properties(gui: Gui, helpers):
 
     md = "<|{data}|chart|x=Date|mode=lines|y[1]=La Rochelle|y[2]=La Rochelle 1|y[3]=La Rochelle 2|y[4]=Montpellier|y[5]=Montpellier 1|y[6]=Montpellier 2|line[2]=dashdot|line[3]=dash|line[5]=dashdot|line[6]=dash|color[2]=blue|color[3]=blue|color[5]=red|color[6]=red|>"  # noqa: E501
 
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     expected_list = [
         "<Chart",
         "&quot;traces&quot;: [[&quot;Date_str&quot;, &quot;La Rochelle&quot;], [&quot;Date_str&quot;, &quot;La Rochelle 1&quot;], [&quot;Date_str&quot;, &quot;La Rochelle 2&quot;], [&quot;Date_str&quot;, &quot;Montpellier&quot;], [&quot;Date_str&quot;, &quot;Montpellier 1&quot;], [&quot;Date_str&quot;, &quot;Montpellier 2&quot;]]",  # noqa: E501
@@ -216,8 +211,7 @@ def test_chart_indexed_properties_with_arrays(gui: Gui, helpers):
 
     md = "<|{data}|chart|x=Date|mode=lines|y={ys}|line={lines}|color={colors}|>"
 
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     expected_list = [
         "<Chart",
         "&quot;traces&quot;: [[&quot;Date_str&quot;, &quot;La Rochelle&quot;], [&quot;Date_str&quot;, &quot;La Rochelle 1&quot;], [&quot;Date_str&quot;, &quot;La Rochelle 2&quot;], [&quot;Date_str&quot;, &quot;Montpellier&quot;], [&quot;Date_str&quot;, &quot;Montpellier 1&quot;], [&quot;Date_str&quot;, &quot;Montpellier 2&quot;]]",  # noqa: E501

+ 6 - 12
tests/gui/control/test_dialog.py

@@ -16,8 +16,7 @@ from taipy.gui import Gui, Markdown
 
 def test_dialog_md_1(gui: Gui, helpers):
     dialog_open = False  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     md_string = "<|dialog|title=This is a Dialog|open={dialog_open}|page=page_test|on_action=validate_action|>"
     expected_list = [
         "<Dialog",
@@ -31,8 +30,7 @@ def test_dialog_md_1(gui: Gui, helpers):
 
 
 def test_dialog_md_2(gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     partial = gui.add_partial(Markdown("# A partial"))  # noqa: F841
     dialog_open = False  # noqa: F841
     md_string = "<|dialog|title=Another Dialog|open={dialog_open}|partial={partial}|on_action=validate_action|>"
@@ -48,8 +46,7 @@ def test_dialog_md_2(gui: Gui, helpers):
 
 
 def test_dialog_labels_md(gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     dialog_open = False  # noqa: F841
     md_string = (
         "<|dialog|title=Another Dialog|open={dialog_open}|page=page_test|labels=Cancel;Validate|close_label=MYClose|>"
@@ -67,8 +64,7 @@ def test_dialog_labels_md(gui: Gui, helpers):
 
 
 def test_dialog_html_1(gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     dialog_open = False  # noqa: F841
     html_string = (
         '<taipy:dialog title="This is a Dialog" open="{dialog_open}" page="page1" on_action="validate_action" />'
@@ -85,8 +81,7 @@ def test_dialog_html_1(gui: Gui, helpers):
 
 
 def test_dialog_html_2(gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     partial = gui.add_partial(Markdown("# A partial"))  # noqa: F841
     dialog_open = False  # noqa: F841
     html_string = (
@@ -104,8 +99,7 @@ def test_dialog_html_2(gui: Gui, helpers):
 
 
 def test_dialog_labels_html(gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     dialog_open = False  # noqa: F841
     html_string = (
         '<taipy:dialog title="Another Dialog" open="{dialog_open}" page="page_test" labels="Cancel;Validate" />'

+ 5 - 10
tests/gui/control/test_input.py

@@ -16,8 +16,7 @@ from taipy.gui import Gui
 
 def test_input_md(gui: Gui, helpers):
     x = "Hello World!"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     md_string = "<|{x}|input|>"
     expected_list = [
         "<Input",
@@ -31,8 +30,7 @@ def test_input_md(gui: Gui, helpers):
 
 def test_password_md(gui: Gui, helpers):
     x = "Hello World!"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     md_string = "<|{x}|input|password|>"
     expected_list = [
         "<Input",
@@ -46,8 +44,7 @@ def test_password_md(gui: Gui, helpers):
 
 def test_input_html_1(gui: Gui, helpers):
     x = "Hello World!"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     html_string = '<taipy:input value="{x}" />'
     expected_list = [
         "<Input",
@@ -61,8 +58,7 @@ def test_input_html_1(gui: Gui, helpers):
 
 def test_password_html(gui: Gui, helpers):
     x = "Hello World!"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     html_string = '<taipy:input value="{x}" password="True" />'
     expected_list = [
         "<Input",
@@ -76,8 +72,7 @@ def test_password_html(gui: Gui, helpers):
 
 def test_input_html_2(gui: Gui, helpers):
     x = "Hello World!"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     html_string = "<taipy:input>{x}</taipy:input>"
     expected_list = [
         "<Input",

+ 2 - 4
tests/gui/control/test_slider.py

@@ -36,8 +36,7 @@ def test_slider_with_min_max(gui: Gui, test_client, helpers):
 def test_slider_with_dict_labels_md(gui: Gui, helpers):
     sel = "Item 1"  # noqa: F841
     labels = {"Item 1": "Label Start", "Item 3": "Label End"}  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     md_string = "<|{sel}|slider|lov=Item 1;Item 2;Item 3|labels={labels}|>"
     expected_list = [
         "<Slider",
@@ -48,8 +47,7 @@ def test_slider_with_dict_labels_md(gui: Gui, helpers):
 
 def test_slider_with_boolean_labels_md(gui: Gui, helpers):
     sel = "Item 1"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     md_string = "<|{sel}|slider|lov=Item 1;Item 2;Item 3|labels|>"
     expected_list = ["<Slider", "labels={true}"]
     helpers.test_control_md(gui, md_string, expected_list)

+ 2 - 4
tests/gui/control/test_status.py

@@ -22,8 +22,7 @@ def test_status_md(gui: Gui, helpers):
         'defaultValue="[&#x7B;&quot;status&quot;: &quot;info&quot;, &quot;message&quot;: &quot;Info Message&quot;&#x7D;]"',  # noqa: E501
         "value={tpec_TpExPr_status_TPMDL_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_md(gui, md_string, expected_list)
 
 
@@ -35,6 +34,5 @@ def test_status_html(gui: Gui, helpers):
         'defaultValue="[&#x7B;&quot;status&quot;: &quot;info&quot;, &quot;message&quot;: &quot;Info Message&quot;&#x7D;]"',  # noqa: E501
         "value={tpec_TpExPr_status_TPMDL_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_html(gui, html_string, expected_list)

+ 5 - 10
tests/gui/control/test_table.py

@@ -27,8 +27,7 @@ def test_table_md_1(gui: Gui, helpers, csvdata):
         'updateVarName="_TpD_tpec_TpExPr_csvdata_TPMDL_0"',
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_md(gui, md_string, expected_list)
 
 
@@ -46,8 +45,7 @@ def test_table_reset_md(gui: Gui, helpers, csvdata):
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
         "columns={tp_TpExPr_gui_tbl_cols_True_None_7B_22columns_22_3A_20_22Day_3BEntity_3BCode_3BDaily_20hospital_20occupancy_22_2C_20_22date_format_22_3A_20_22eee_20dd_20MMM_20yyyy_22_7D_7B_22data_22_3A_20_22tpec_TpExPr_csvdata_TPMDL_0_22_7D_tpec_TpExPr_csvdata_TPMDL_0_csvdata_TPMDL_0_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_md(gui, md_string, expected_list)
 
 
@@ -82,8 +80,7 @@ def test_table_md_2(gui: Gui, helpers, csvdata):
         'updateVarName="_TpD_tpec_TpExPr_csvdata_TPMDL_0"',
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_md(gui, md_string, expected_list)
 
 
@@ -100,8 +97,7 @@ def test_table_html_1(gui: Gui, helpers, csvdata):
         'updateVarName="_TpD_tpec_TpExPr_csvdata_TPMDL_0"',
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_html(gui, html_string, expected_list)
 
 
@@ -136,6 +132,5 @@ def test_table_html_2(gui: Gui, helpers, csvdata):
         'updateVarName="_TpD_tpec_TpExPr_csvdata_TPMDL_0"',
         "data={_TpD_tpec_TpExPr_csvdata_TPMDL_0}",
     ]
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     helpers.test_control_html(gui, html_string, expected_list)

+ 1 - 2
tests/gui/data/test_pandas_data_accessor.py

@@ -209,8 +209,7 @@ def test_decimator(gui: Gui, helpers, small_dataframe):
     pd = pandas.DataFrame(data=small_dataframe)
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", "<|Hello {a_decimator}|button|id={btn_id}|>")
     with patch("sys.argv", ["prog"]):

+ 1 - 2
tests/gui/e2e/page_scopes/test_class_scopes_binding_global.py

@@ -37,8 +37,7 @@ def helpers_assert_value(page, s1, s2, v1):
 @pytest.mark.teste2e
 @pytest.mark.filterwarnings("ignore::Warning")
 def test_class_scopes_binding(page: "Page", gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     operand_1 = 0  # noqa: F841
     gui.add_page("page1", Page1())
     gui.add_page("page2", Page2())

+ 1 - 2
tests/gui/e2e/page_scopes/test_class_scopes_main_var_access.py

@@ -32,8 +32,7 @@ def helpers_assert_text(page, s):
 @pytest.mark.teste2e
 @pytest.mark.filterwarnings("ignore::Warning")
 def test_class_scopes_main_var_access(page: "Page", gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     n = "Hello"  # noqa: F841
 
     root_md = Markdown(

+ 1 - 2
tests/gui/e2e/page_scopes/test_page_scopes.py

@@ -28,8 +28,7 @@ from .assets.page3 import page as page3
 @pytest.mark.timeout(300)
 @pytest.mark.teste2e
 def test_page_scopes(page: "Page", gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     def on_change(state, var, val, module):
         if var == "x" and "page3" in module:

+ 1 - 2
tests/gui/e2e/page_scopes/test_page_scopes_binding_global.py

@@ -37,8 +37,7 @@ def helpers_assert_value(page, s1, s2, v1):
 @pytest.mark.teste2e
 @pytest.mark.filterwarnings("ignore::Warning")
 def test_page_scopes_binding(page: "Page", gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     operand_1 = 0  # noqa: F841
     gui.add_page("page1", page1)
     gui.add_page("page2", page2)

+ 1 - 2
tests/gui/e2e/page_scopes/test_page_scopes_main_var_access.py

@@ -32,8 +32,7 @@ def helpers_assert_text(page, s):
 @pytest.mark.teste2e
 @pytest.mark.filterwarnings("ignore::Warning")
 def test_page_scopes_main_var_access(page: "Page", gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     n = "Hello"  # noqa: F841
 
     root_md = Markdown(

+ 1 - 2
tests/gui/e2e/page_scopes/test_page_scopes_state.py

@@ -28,8 +28,7 @@ from .assets4.page1 import reset_d
 @pytest.mark.teste2e
 @pytest.mark.filterwarnings("ignore::Warning")
 def test_page_scopes_state_runtime(page: "Page", gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     def test(state):
         reset_d(state)

+ 2 - 4
tests/gui/e2e/renderers/test_html_rendering.py

@@ -44,8 +44,7 @@ def test_html_render_with_style(page: "Page", gui: Gui, helpers):
     <taipy:text id="text2" class="custom-text">There</taipy:text>
 </body>
 </html>"""
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page("page1", Html(html_content))
     helpers.run_e2e(gui)
     page.goto("./page1")
@@ -71,8 +70,7 @@ def test_html_render_with_style(page: "Page", gui: Gui, helpers):
 
 @pytest.mark.teste2e
 def test_html_render_bind_assets(page: "Page", gui: Gui, helpers, e2e_base_url, e2e_port):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_pages(pages=f"{Path(Path(__file__).parent.resolve())}{os.path.sep}test-assets")
     helpers.run_e2e(gui)
     assert ".taipy-text" in urlopen(

+ 1 - 2
tests/gui/e2e/renderers/test_markdown_rendering.py

@@ -35,8 +35,7 @@ def test_markdown_render_with_style(page: "Page", gui: Gui, helpers):
     color: blue;
 }
 """
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page("page1", markdown_content, style=style)
     helpers.run_e2e(gui)
     page.goto("./page1")

+ 2 - 4
tests/gui/e2e/test_accessor_data_format.py

@@ -23,8 +23,7 @@ from taipy.gui import Gui
 @pytest.mark.teste2e
 def test_accessor_json(page: "Page", gui: Gui, csvdata, helpers):
     table_data = csvdata  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(
         name="test",
         page="<|{table_data}|table|columns=Day;Entity;Code;Daily hospital occupancy|date_format=eee dd MMM yyyy|id=table1|>",  # noqa: E501
@@ -40,8 +39,7 @@ def test_accessor_json(page: "Page", gui: Gui, csvdata, helpers):
 def test_accessor_arrow(page: "Page", gui: Gui, csvdata, helpers):
     if util.find_spec("pyarrow"):
         table_data = csvdata  # noqa: F841
-        if frame := inspect.currentframe():
-            gui._set_frame(frame)
+        gui._set_frame(inspect.currentframe())
         gui.add_page(
             name="test",
             page="<|{table_data}|table|columns=Day;Entity;Code;Daily hospital occupancy|date_format=eee dd MMM yyyy|id=table1|>",  # noqa: E501

+ 5 - 10
tests/gui/e2e/test_margin.py

@@ -25,8 +25,7 @@ def test_margin_1(page: "Page", gui: Gui, helpers):
     page_md = """
 <|Just a page|id=text1|>
 """
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui, dark_mode=False, margin="10rem")
     page.goto("./")
@@ -41,8 +40,7 @@ def test_margin_2(page: "Page", gui: Gui, helpers):
     page_md = """
 <|Just a page|id=text1|>
 """
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui, dark_mode=False)
     page.goto("./")
@@ -57,8 +55,7 @@ def test_margin_3(page: "Page", gui: Gui, helpers):
     page_md = """
 <|Just a page|id=text1|>
 """
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui, dark_mode=False, margin="10rem", stylekit=True)
     page.goto("./")
@@ -73,8 +70,7 @@ def test_margin_4(page: "Page", gui: Gui, helpers):
     page_md = """
 <|Just a page|id=text1|>
 """
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui, dark_mode=False, stylekit={"root_margin": "20rem"})
     page.goto("./")
@@ -89,8 +85,7 @@ def test_margin_5(page: "Page", gui: Gui, helpers):
     page_md = """
 <|Just a page|id=text1|>
 """
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui, dark_mode=False, stylekit={"root_margin": "20rem"}, margin="10rem")
     page.goto("./")

+ 1 - 2
tests/gui/e2e/test_navbar_navigate.py

@@ -24,8 +24,7 @@ from taipy.gui import Gui
 
 @pytest.mark.teste2e
 def test_navbar_navigate(page: "Page", gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="Data", page="<|navbar|id=nav1|> <|Data|id=text-data|>")
     gui.add_page(name="Test", page="<|navbar|id=nav1|> <|Test|id=text-test|>")
     helpers.run_e2e(gui)

+ 1 - 2
tests/gui/e2e/test_redirect.py

@@ -25,8 +25,7 @@ def test_redirect(page: "Page", gui: Gui, helpers):
     page_md = """
 <|Redirect Successfully|id=text1|>
 """
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui)
     page.goto("./")

+ 2 - 4
tests/gui/e2e/test_theme.py

@@ -25,8 +25,7 @@ def test_theme_light(page: "Page", gui: Gui, helpers):
     page_md = """
 <|Just a page|id=text1|>
 """
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui, dark_mode=False)
     page.goto("./")
@@ -43,8 +42,7 @@ def test_theme_dark(page: "Page", gui: Gui, helpers):
     page_md = """
 <|Just a page|id=text1|>
 """
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui, dark_mode=True)
     page.goto("./")

+ 2 - 4
tests/gui/e2e/test_timezone.py

@@ -57,8 +57,7 @@ def _timezone_test_template(page: "Page", gui: Gui, helpers, time_zone, texts):
 <|{t}|id=text1|>
 """
     t = _string_to_date("2022-03-03T00:00:00.000Z")  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui, time_zone=time_zone)
     page.goto("./test")
@@ -73,8 +72,7 @@ def test_date_only(page: "Page", gui: Gui, helpers):
 <|{t}|id=text1|>
 """
     t = _string_to_date("Wed Jul 28 1993")  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui)
     page.goto("./test")

+ 1 - 2
tests/gui/e2e/with_action/test_button_action.py

@@ -33,8 +33,7 @@ def test_button_action(page: "Page", gui: Gui, helpers):
     def do_something_fn(state):
         state.x = state.x * 2
 
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui)
     page.goto("./test")

+ 1 - 2
tests/gui/e2e/with_action/test_dict.py

@@ -38,8 +38,7 @@ def test_dict(page: "Page", gui: Gui, helpers):
     def on_action_2(state):
         state.a_dict[state.a_key] = "World"
 
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui)
     page.goto("./test")

+ 1 - 2
tests/gui/e2e/with_action/test_selector_action.py

@@ -34,8 +34,7 @@ def test_selector_action(page: "Page", gui: Gui, helpers):
         if var == "x":
             assert val == "Item 3"
 
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui)
     page.goto("./test")

+ 2 - 4
tests/gui/e2e/with_action/test_slider_action.py

@@ -29,8 +29,7 @@ def test_slider_action(page: "Page", gui: Gui, helpers):
 <|{x}|slider|id=slider1|>
 """
     x = 10  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui)
     page.goto("./test")
@@ -65,8 +64,7 @@ Value: <|{d.v1}|id=text1|>
 
 Slider: <|{d.v2}|slider|id=slider1|>
 """
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui)
     page.goto("./test")

+ 1 - 2
tests/gui/e2e/with_action/test_slider_input_reload.py

@@ -74,8 +74,7 @@ def test_slider_input_reload(page: "Page", gui: Gui, helpers):
 <|{val}|slider|id=input2|>
 """
     val = 0  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="page1", page=page_md)
     helpers.run_e2e_multi_client(gui)
     page.goto("./page1")

+ 2 - 4
tests/gui/e2e/with_action/test_text_edit.py

@@ -29,8 +29,7 @@ def test_text_edit(page: "Page", gui: Gui, helpers):
 <|{x}|input|id=input1|>
 """
     x = "Hey"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui)
     page.goto("./test")
@@ -60,8 +59,7 @@ def test_number_edit(page: "Page", gui: Gui, helpers):
 
 """
     x = 10  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page(name="test", page=page_md)
     helpers.run_e2e(gui)
     page.goto("./test")

+ 7 - 14
tests/gui/extension/test_library.py

@@ -96,8 +96,7 @@ Gui.add_library(MyLibrary())
 
 def test_lib_input_md(gui: Gui, test_client, helpers):
     val = ""  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     md_string = "<|{val}|test_lib.testinput|multiline|>"
     expected_list = [
         "<TestLib_Input",
@@ -112,8 +111,7 @@ def test_lib_input_md(gui: Gui, test_client, helpers):
 
 def test_lib_xhtml_md(gui: Gui, test_client, helpers):
     val = "title"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     md_string = "<|{val}|test_lib.title|>"
     expected = [f"<h1>{val}</h1>"]
     helpers.test_control_md(gui, md_string, expected)
@@ -121,8 +119,7 @@ def test_lib_xhtml_md(gui: Gui, test_client, helpers):
 
 def test_lib_xhtml_fail_md(gui: Gui, test_client, helpers):
     val = "title"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     md_string = "<|{val}|test_lib.title_fail|>"
     expected = ["title_fail.render_xhtml() did not return a valid XHTML string. unclosed token: line 1, column 9"]
     helpers.test_control_md(gui, md_string, expected)
@@ -130,8 +127,7 @@ def test_lib_xhtml_fail_md(gui: Gui, test_client, helpers):
 
 def test_lib_input_html_1(gui: Gui, test_client, helpers):
     val = ""  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     html_string = '<test_lib:testinput value="{val}" multiline="true" />'
     expected_list = [
         "<TestLib_Input",
@@ -146,8 +142,7 @@ def test_lib_input_html_1(gui: Gui, test_client, helpers):
 
 def test_lib_input_html_2(gui: Gui, test_client, helpers):
     val = ""  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     html_string = '<test_lib:testinput multiline="true">{val}</test_lib:testinput>'
     expected_list = [
         "<TestLib_Input",
@@ -162,8 +157,7 @@ def test_lib_input_html_2(gui: Gui, test_client, helpers):
 
 def test_lib_inner_md(gui: Gui, test_client, helpers):
     val = "title"  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     md_string = "<|{val}|test_lib.inner|>"
     expected = [
         "<TestLib_Inner",
@@ -174,8 +168,7 @@ def test_lib_inner_md(gui: Gui, test_client, helpers):
 
 
 def test_lib_inner_no_value_md(gui: Gui, test_client, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     md_string = "<|test_lib.inner|>"
     expected = ["<TestLib_Inner", "withProperty={tpec_TpExPr_None_TPMDL_0}"]
     helpers.test_control_md(gui, md_string, expected)

+ 5 - 10
tests/gui/gui_specific/test_expression.py

@@ -31,8 +31,7 @@ def test_expression_text_control_int(gui: Gui, test_client, helpers):
 
 
 def test_expression_text_control_1(gui: Gui, test_client, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui._bind_var_val("x", 10)
     gui._bind_var_val("y", 20)
     md_string = "<|{x + y}|>"
@@ -46,8 +45,7 @@ def test_expression_text_control_1(gui: Gui, test_client, helpers):
 
 
 def test_expression_text_control_2(gui: Gui, test_client, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui._bind_var_val("x", 10)
     gui._bind_var_val("y", 20)
     md_string = "<|x + y = {x + y}|>"
@@ -61,8 +59,7 @@ def test_expression_text_control_2(gui: Gui, test_client, helpers):
 
 
 def test_expression_text_control_3(gui: Gui, test_client, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui._bind_var_val("x", "Mickey Mouse")
     gui._bind_var_val("y", "Donald Duck")
     md_string = "<|Hello {x} and {y}|>"
@@ -76,8 +73,7 @@ def test_expression_text_control_3(gui: Gui, test_client, helpers):
 
 
 def test_expression_text_gt_operator(gui: Gui, test_client, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui._bind_var_val("x", 0)
     md_string = "<|{x > 0}|>"
     expected_list = [
@@ -97,8 +93,7 @@ def test_expression_button_control(gui: Gui, test_client, helpers):
 
 
 def test_expression_table_control(gui: Gui, test_client, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui._bind_var_val("pd", pd)
     gui._bind_var_val("series_1", pd.Series(["a", "b", "c"], name="Letters"))
     gui._bind_var_val("series_2", pd.Series([1, 2, 3], name="Numbers"))

+ 1 - 2
tests/gui/gui_specific/test_folder_pages_binding.py

@@ -19,8 +19,7 @@ from taipy.gui import Gui
 
 def test_folder_pages_binding(gui: Gui):
     folder_path = f"{Path(Path(__file__).parent.resolve())}{os.path.sep}sample_assets"
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_pages(folder_path)
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False)

+ 4 - 8
tests/gui/gui_specific/test_navigate.py

@@ -21,8 +21,7 @@ def test_navigate(gui: Gui, helpers):
         navigate(state, "test")
 
     with warnings.catch_warnings(record=True):
-        if frame := inspect.currentframe():
-            gui._set_frame(frame)
+        gui._set_frame(inspect.currentframe())
         gui.add_page("test", Markdown("#This is a page"))
         with patch("sys.argv", ["prog"]):
             gui.run(run_server=False)
@@ -42,8 +41,7 @@ def test_navigate_to_no_route(gui: Gui, helpers):
         navigate(state, "toto")
 
     with warnings.catch_warnings(record=True):
-        if frame := inspect.currentframe():
-            gui._set_frame(frame)
+        gui._set_frame(inspect.currentframe())
         gui.add_page("test", Markdown("#This is a page"))
         with patch("sys.argv", ["prog"]):
             gui.run(run_server=False)
@@ -63,8 +61,7 @@ def test_on_navigate_to_inexistant(gui: Gui, helpers):
         return "test2" if page == "test" else page
 
     with warnings.catch_warnings(record=True) as records:
-        if frame := inspect.currentframe():
-            gui._set_frame(frame)
+        gui._set_frame(inspect.currentframe())
         gui.add_page("test", Markdown("#This is a page"))
         with patch("sys.argv", ["prog"]):
             gui.run(run_server=False)
@@ -83,8 +80,7 @@ def test_on_navigate_to_existant(gui: Gui, helpers):
         return "test2" if page == "test1" else page
 
     with warnings.catch_warnings(record=True):
-        if frame := inspect.currentframe():
-            gui._set_frame(frame)
+        gui._set_frame(inspect.currentframe())
         gui.add_page("test1", Markdown("#This is a page test1"))
         gui.add_page("test2", Markdown("#This is a page test2"))
         with patch("sys.argv", ["prog"]):

+ 1 - 2
tests/gui/gui_specific/test_render_route.py

@@ -18,8 +18,7 @@ from taipy.gui import Gui
 
 
 def test_render_route(gui: Gui):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page("page1", "# first page")
     gui.add_page("page2", "# second page")
     with patch("sys.argv", ["prog"]):

+ 1 - 2
tests/gui/gui_specific/test_run_thread.py

@@ -19,8 +19,7 @@ from taipy.gui import Gui
 
 # this hangs in github
 def test_run_thread(gui: Gui, helpers):
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page("page1", "# first page")
     with patch("sys.argv", ["prog"]):
         gui.run(run_in_thread=True, run_browser=False)

+ 1 - 2
tests/gui/gui_specific/test_state.py

@@ -21,8 +21,7 @@ from .state_asset.page1 import get_a, md_page1, set_a
 
 def test_state(gui: Gui):
     a = 10  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page("page1", md_page1)
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False, single_client=True)

+ 1 - 2
tests/gui/ignore/no_file/test_ignore.py

@@ -18,8 +18,7 @@ from taipy.gui import Gui
 
 def test_no_ignore_file(gui: Gui):
     with warnings.catch_warnings(record=True):
-        if frame := inspect.currentframe():
-            gui._set_frame(frame)
+        gui._set_frame(inspect.currentframe())
         with patch("sys.argv", ["prog"]):
             gui.run(run_server=False)
         client = gui._server.test_client()

+ 2 - 4
tests/gui/ignore/with_file/test_with_ignore.py

@@ -18,8 +18,7 @@ from taipy.gui import Gui
 
 def test_ignore_file_found(gui: Gui):
     with warnings.catch_warnings(record=True):
-        if frame := inspect.currentframe():
-            gui._set_frame(frame)
+        gui._set_frame(inspect.currentframe())
         with patch("sys.argv", ["prog"]):
             gui.run(run_server=False)
         client = gui._server.test_client()
@@ -31,8 +30,7 @@ def test_ignore_file_found(gui: Gui):
 
 def test_ignore_file_not_found(gui: Gui):
     with warnings.catch_warnings(record=True):
-        if frame := inspect.currentframe():
-            gui._set_frame(frame)
+        gui._set_frame(inspect.currentframe())
         with patch("sys.argv", ["prog"]):
             gui.run(run_server=False)
         client = gui._server.test_client()

+ 1 - 2
tests/gui/long_runnig/test_long_running.py

@@ -32,8 +32,7 @@ def test_long_callback(gui: Gui):
     def on_exception(state: State, function_name: str, e: Exception):
         state.status = -1
 
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False, single_client=True)
     state = gui._Gui__state  # type: ignore[attr-defined]

+ 1 - 2
tests/gui/renderers/test_html_parsing.py

@@ -18,8 +18,7 @@ from taipy.gui import Gui, Html
 def test_simple_html(gui: Gui, helpers):
     # html_string = "<html><head></head><body><h1>test</h1><taipy:field value=\"test\"/></body></html>"
     html_string = "<html><head></head><body><h1>test</h1></body></html>"
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     gui.add_page("test", Html(html_string))
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False)

+ 1 - 2
tests/gui/server/http/test_file_upload.py

@@ -109,8 +109,7 @@ def test_file_upload_multi_part(gui: Gui, helpers):
 
 def test_file_upload_multiple(gui: Gui, helpers):
     var_name = "varname"
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False, single_client=True)
     flask_client = gui._server.test_client()

+ 1 - 2
tests/gui/server/http/test_status.py

@@ -54,8 +54,7 @@ def test_get_status_with_user_status(gui: Gui):
     def on_status(state):
         return user_status
 
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False)

+ 2 - 4
tests/gui/server/http/test_user_content.py

@@ -31,8 +31,7 @@ def test_user_content_with_wrong_callback(gui: Gui, helpers):
         return None
 
     on_user_content = on_user_content_cb  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False, single_client=True)
     flask_client = gui._server.test_client()
@@ -46,8 +45,7 @@ def test_user_content_with_callback(gui: Gui, helpers):
         return ""
 
     on_user_content = on_user_content_cb  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False, single_client=True)
     flask_client = gui._server.test_client()

+ 1 - 2
tests/gui/server/ws/test_a.py

@@ -23,8 +23,7 @@ def test_a_button_pressed(gui: Gui, helpers):
     x = 10  # noqa: F841
     text = "hi"  # noqa: F841
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     # Bind a page so that the variable will be evaluated as expression
     gui.add_page(
         "test", Markdown("<|Do something!|button|on_action=do_something|id=my_button|> | <|{x}|> | <|{text}|>")

+ 1 - 2
tests/gui/server/ws/test_broadcast.py

@@ -20,8 +20,7 @@ def test_broadcast(gui: Gui, helpers):
     selected_val = ["value1", "value2"]  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     # Bind a page so that the variable will be evaluated as expression
     gui.add_page(

+ 1 - 2
tests/gui/server/ws/test_df.py

@@ -26,8 +26,7 @@ def test_download_file(gui: Gui, helpers):
     #     "test", Markdown("<|Do something!|button|on_action=do_something|id=my_button|>")
     # )
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False)

+ 1 - 2
tests/gui/server/ws/test_du.py

@@ -20,8 +20,7 @@ def test_du_table_data_fetched(gui: Gui, helpers, csvdata):
     csvdata = csvdata
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     Gui._set_timezone("UTC")
 
     # Bind a page so that the variable will be evaluated as expression

+ 2 - 4
tests/gui/server/ws/test_on_change.py

@@ -24,8 +24,7 @@ def test_default_on_change(gui: Gui, helpers):
     x = 10  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", Markdown("<|{x}|input|>"))
     with patch("sys.argv", ["prog"]):
@@ -54,8 +53,7 @@ def test_specific_on_change(gui: Gui, helpers):
     x = 10  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", Markdown("<|{x}|input|on_change=on_input_change|>"))
     with patch("sys.argv", ["prog"]):

+ 1 - 2
tests/gui/server/ws/test_ru.py

@@ -20,8 +20,7 @@ def test_ru_selector(gui: Gui, helpers, csvdata):
     selected_val = ["value1", "value2"]  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     # Bind a page so that the variable will be evaluated as expression
     gui.add_page(

+ 3 - 6
tests/gui/server/ws/test_u.py

@@ -20,8 +20,7 @@ def ws_u_assert_template(gui: Gui, helpers, value_before_update, value_after_upd
     var = value_before_update  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     # Bind a page so that the variable will be evaluated as expression
     gui.add_page("test", Markdown("<|{var}|>"))
@@ -48,8 +47,7 @@ def test_ws_u_string(gui: Gui, helpers):
     payload = {"value": value_after_update}
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     ws_u_assert_template(gui, helpers, value_before_update, value_after_update, payload)
 
@@ -60,7 +58,6 @@ def test_ws_u_number(gui: Gui, helpers):
     payload = {"value": value_after_update}
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     ws_u_assert_template(gui, helpers, value_before_update, value_after_update, payload)

+ 1 - 2
tests/gui/server/ws/test_with.py

@@ -21,8 +21,7 @@ def test_sending_messages_in_group(gui: Gui, helpers):
     btn_id = "button1"  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     gui.add_page("test", Markdown("<|Hello {name}|button|id={btn_id}|>"))
     with patch("sys.argv", ["prog"]):

+ 4 - 8
tests/gui/utils/test_evaluator.py

@@ -35,8 +35,7 @@ def test_unbind_variable_in_expression(gui: Gui, helpers):
 
 def test_evaluate_same_expression_multiple_times(gui: Gui):
     x = 10  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False, single_client=True)
     with gui.get_flask_app().app_context():
@@ -47,8 +46,7 @@ def test_evaluate_same_expression_multiple_times(gui: Gui):
 
 def test_evaluate_expressions_same_variable(gui: Gui):
     x = 10  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False, single_client=True)
     with gui.get_flask_app().app_context():
@@ -59,8 +57,7 @@ def test_evaluate_expressions_same_variable(gui: Gui):
 
 def test_evaluate_holder(gui: Gui):
     x = 10  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False, single_client=True)
     with warnings.catch_warnings(record=True):
@@ -86,8 +83,7 @@ def test_evaluate_not_expression_type(gui: Gui):
 def test_evaluate_expression_2_clients(gui: Gui):
     x = 10  # noqa: F841
     y = 20  # noqa: F841
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False)
     with gui.get_flask_app().app_context():

+ 4 - 5
tests/gui/utils/test_map_dict.py

@@ -110,8 +110,7 @@ def test_map_dict_set(gui: Gui, test_client):
     d = {"a": 1}  # noqa: F841
 
     # set gui frame
-    if frame := inspect.currentframe():
-        gui._set_frame(frame)
+    gui._set_frame(inspect.currentframe())
 
     with patch("sys.argv", ["prog"]):
         gui.run(run_server=False, single_client=True)
@@ -119,9 +118,9 @@ def test_map_dict_set(gui: Gui, test_client):
         assert isinstance(gui._Gui__state.d, _MapDict)  # type: ignore[attr-defined]
         gui._Gui__state.d = {"b": 2}  # type: ignore[attr-defined]
         assert isinstance(gui._Gui__state.d, _MapDict)  # type: ignore[attr-defined]
-        assert len(gui._Gui__state.d) == 1
-        assert gui._Gui__state.d.get("a", None) is None
-        assert gui._Gui__state.d.get("b", None) == 2
+        assert len(gui._Gui__state.d) == 1  # type: ignore[attr-defined]
+        assert gui._Gui__state.d.get("a", None) is None  # type: ignore[attr-defined]
+        assert gui._Gui__state.d.get("b", None) == 2  # type: ignore[attr-defined]
 
 
 def test_map_dict_items():