Ejemplo n.º 1
0
    def test_find_default(self) -> None:
        """Validate default value functionality."""
        mute_map = MutableMap(**VALUE)

        assert (mute_map.find(
            "NOT_VALID",
            "default_val") == "default_val"), "default should be used"
        assert (mute_map.find(
            "str_val",
            "default_val") == VALUE["str_val"]), "default should be ignored"
Ejemplo n.º 2
0
    def test_find(self) -> None:
        """Validate the `find` method with and without `ignore_cache`.

        Also tests the `clear_found_cache` method and setting an attr value
        using dot notation.

        """
        mute_map = MutableMap(**VALUE)

        assert mute_map.find("str_val") == VALUE["str_val"]

        mute_map["str_val"] = "new_val"

        assert mute_map.find("str_val") == VALUE["str_val"]
        assert mute_map.find("str_val", ignore_cache=True) == "new_val"

        mute_map.clear_found_cache()

        assert mute_map.find("str_val") == "new_val"