# SPDX-FileCopyrightText: 2018-2021 Bruce Cowan <bruce@bcowan.me.uk> # # SPDX-License-Identifier: GPL-3.0-or-later import queue import pytest pytest_plugins = ["errbot.backends.test"] extra_plugin_dir = '.' def test_regex(testbot): testbot.assertInCommand("test++", "Karma for 'test' is now 1") testbot.assertInCommand("!karma test", "Karma for 'test' is 1") testbot.assertInCommand("test--", "Karma for 'test' is now 0") testbot.assertInCommand("!karma test", "Karma for 'test' is 0") def test_top_bottom(testbot): testbot.assertInCommand("high++", "Karma for 'high' is now 1") testbot.assertInCommand("high++", "Karma for 'high' is now 2") testbot.assertInCommand("medium++", "Karma for 'medium' is now 1") testbot.assertInCommand("low--", "Karma for 'low' is now -1") testbot.assertInCommand("!karma top", "high: 2, medium: 1, low: -1") testbot.assertInCommand("!karma bottom", "low: -1, medium: 1, high: 2") testbot.assertInCommand("!karma top 1", "high: 2") testbot.assertInCommand("!karma top 2", "high: 2, medium: 1") def test_cpp(testbot): testbot.push_message("c++ is horrible") with pytest.raises(queue.Empty): testbot.pop_message(1) testbot.push_message("C++ is not horrible") with pytest.raises(queue.Empty): testbot.pop_message(1)