def test_match_domain(a: Any, b: Any, result: Any) -> None: if "*" in a: rule = MaskDomain(a) else: rule = Domain(a) assert rule.match_domain(b) is result
def test_domain_valid() -> None: assert Domain("example.com:81").canonical == "example.com:81" assert MaskDomain("*.example.com").canonical == r".*\.example\.com" assert Domain("пуни.код").canonical == "xn--h1ajfq.xn--d1alm"
def test_domain_valid(): assert Domain('example.com:81').canonical == 'example.com:81' assert MaskDomain('*.example.com').canonical == r'.*\.example\.com' assert Domain('пуни.код').canonical == 'xn--h1ajfq.xn--d1alm'
def test_match_domain(a, b, result): if '*' in a: rule = MaskDomain(a) else: rule = Domain(a) assert rule.match_domain(b) is result