from typing import List, Optional import pytest from audience_common.utils.urlpath import is_path_match, is_path_match_re @pytest.mark.parametrize( "path, match, expected", [ ("/hello/", ["/hello/"], True), ("/health", ["/_healthcheck"], False), ("/any", None, False), ], ) def test_is_url_path_match( path: str, match: Optional[List[str]], expected: bool ) -> None: assert is_path_match(path, match=match) == expected @pytest.mark.parametrize( "path, match, expected", [ ("/hello/", ["/hello/"], True), ("/health", ["/_healthcheck"], False), ("/static/image.jpg", ["/static/*"], True), ("/any", ["/.+"], True), ("/any", None, False), ], ) def test_is_url_path_match_re( path: str, match: Optional[List[str]], expected: bool ) -> None: assert is_path_match_re(path, match=match) == expected