def check_inner(text, expected):
        bot = FakeBot()
        for pattern in keys:
            wrapped = to_search(pattern)
            match = re.match(wrapped, text)
            if match:
                srl(bot, FakeTrigger(match))

        actual = bot.messages
        assert actual == expected, "Wrong output for '{0}'.".format(text)
Пример #2
0
    def check_inner(text, expected):
        bot = FakeBot()
        for pattern in keys:
            wrapped = to_search(pattern)
            match = re.match(wrapped, text)
            if match:
                srl(bot, FakeTrigger(match))

        actual = bot.messages
        assert actual == expected, "Wrong output for '{0}'.".format(text)
Пример #3
0
def helper(pattern, val, text, expected):
    rules = {pattern: val}
    srl = SRLinks(rules)

    match = re.match(to_search(pattern), text)
    trigger = FakeTrigger(match)
    bot = FakeBot()

    srl(bot, trigger)

    actual = bot.messages
    assert actual == expected, "Wrong output"