示例#1
0
def test_load_app_settings_w_missing_props():
    settings = {
        "theme": "light",
        "github_fork": False,
        "hide_shutdown": True,
        "pin_menu": True,
        "language": "cn",
        "max_column_width": None,
        "query_engine": "python",
    }
    with ExitStack() as stack:
        stack.enter_context(mock.patch("dtale.global_state.APP_SETTINGS", settings))

        load_app_settings(None)
        assert settings["hide_shutdown"]
        assert settings["pin_menu"]
        assert settings["language"] == "cn"
        assert settings["max_column_width"] is None

        load_app_settings(
            load_config_state(
                os.path.join(os.path.dirname(__file__), "dtale_missing_props.ini")
            )
        )
        assert not settings["hide_shutdown"]
        assert settings["pin_menu"]
        assert settings["language"] == "cn"
        assert settings["max_column_width"] is None
示例#2
0
def test_load_app_settings():
    settings = {
        "theme": "dark",
        "github_fork": False,
        "hide_shutdown": True,
        "pin_menu": True,
        "language": "cn",
        "max_column_width": 50,
        "query_engine": "numexpr",
    }
    with ExitStack() as stack:
        stack.enter_context(mock.patch("dtale.global_state.APP_SETTINGS", settings))

        load_app_settings(None)
        assert settings["hide_shutdown"]
        assert settings["pin_menu"]
        assert settings["language"] == "cn"
        assert settings["theme"] == "dark"
        assert settings["max_column_width"] == 50
        assert settings["query_engine"] == "numexpr"

        load_app_settings(
            load_config_state(os.path.join(os.path.dirname(__file__), "dtale.ini"))
        )
        assert not settings["hide_shutdown"]
        assert not settings["pin_menu"]
        assert settings["language"] == "en"
        assert settings["theme"] == "light"
        assert settings["max_column_width"] == 100
        assert settings["main_title"] == "My App"
        assert settings["main_title_font"] == "Arial"
        assert settings["query_engine"] == "python"
示例#3
0
def test_load_app_settings():
    settings = {
        "theme": "dark",
        "github_fork": False,
        "hide_shutdown": True,
        "pin_menu": True,
        "language": "cn",
    }
    with ExitStack() as stack:
        stack.enter_context(
            mock.patch("dtale.global_state.APP_SETTINGS", settings))

        load_app_settings(None)
        assert settings["hide_shutdown"]
        assert settings["pin_menu"]
        assert settings["language"] == "cn"
        assert settings["theme"] == "dark"

        load_app_settings(
            load_config_state(
                os.path.join(os.path.dirname(__file__), "dtale.ini")))
        assert not settings["hide_shutdown"]
        assert not settings["pin_menu"]
        assert settings["language"] == "en"
        assert settings["theme"] == "light"
示例#4
0
def test_load_app_settings_w_missing_props():
    settings = {
        "theme": "light",
        "github_fork": False,
        "hide_shutdown": True,
    }
    with ExitStack() as stack:
        stack.enter_context(mock.patch("dtale.global_state.APP_SETTINGS", settings))

        load_app_settings(None)
        assert settings["hide_shutdown"]

        load_app_settings(
            load_config_state(
                os.path.join(os.path.dirname(__file__), "dtale_missing_props.ini")
            )
        )
        assert not settings["hide_shutdown"]