diff --git a/src/pycookiecheat/firefox.py b/src/pycookiecheat/firefox.py index ae68454..483e69a 100644 --- a/src/pycookiecheat/firefox.py +++ b/src/pycookiecheat/firefox.py @@ -75,10 +75,7 @@ def _get_profiles_dir_for_os( raise ValueError( f"OS must be one of {list(FIREFOX_OS_PROFILE_DIRS.keys())}" ) - try: - return Path(os_config[browser]).expanduser() - except KeyError: - raise ValueError(f"Browser must be one of {list(os_config.keys())}") + return Path(os_config[browser]).expanduser() def _find_firefox_default_profile(firefox_dir: Path) -> str: diff --git a/tests/test_firefox.py b/tests/test_firefox.py index af4379c..f8578ba 100644 --- a/tests/test_firefox.py +++ b/tests/test_firefox.py @@ -262,8 +262,10 @@ def test_get_profiles_dir_for_os_invalid() -> None: """Test invalid OS and browser names.""" with pytest.raises(ValueError, match="OS must be one of"): _get_profiles_dir_for_os("invalid") - with pytest.raises(ValueError, match="Browser must be one of"): - _get_profiles_dir_for_os("linux", "invalid") # type: ignore + with pytest.raises( + ValueError, match="'invalid' is not a valid BrowserType" + ): + _get_profiles_dir_for_os("linux", BrowserType("invalid")) # _find_firefox_default_profile()