def test_match_basic_bool(self): match = pattern((bool, lambda i: False)) result = match(True) assert not result
def test_match_basic_float(self): match = pattern((float, lambda i: i + 1)) result = match(0.0) assert result == 1.0
def test_match_basic_int(self): match = pattern((int, lambda i: i + 1)) result = match(0) assert result == 1
def test_match_basic_str(self): match = pattern((str, lambda i: "goodbye")) result = match("Hello World") assert result == "goodbye"
def test_does_not_match_pattern(self): match = pattern((int, lambda i: i + 1)) result = match("Hello World") assert result is None
def test_no_patterns_pattern(self): match = pattern() result = match("Hello World") assert result is None