def test_ord(): assert match("a <b>", "") is None assert match("a <b>", "a") is None assert match("a <b>", "a", as_json=True) is None assert match("a <b>!", "") is None assert match("a <b>!", "text?") is None assert (match("a <b>!..<c>", "a oh!..hello!") == { "b": "oh", "c": "hello!" } == json.loads(match("a <b>!..<c>", "a oh!..hello!", as_json=True)))
def test_spec(): assert match("hello", "hello") is not None assert match("hello", "") is None
def test_some(): assert match("<1> <s> <1>", " road ") is None assert match("<1> <s> <1>", "the road to hel") == {"s": "road"}
def test_complic(): assert match("If <conditional>, then <consequence>", "If I listen to music, then I'm fine") == { "conditional": "I listen to music", "consequence": "I'm fine" }
def test_ignore(): assert match("<!>hello<!>", "hello") is not None assert match("<!>hello<!>", "test") is None assert match("<!> <s> <!>", "The road to hel") == {"s": "road"} assert match("<!> <s> <!>", " road ") == {"s": "road"}