From 1231e9066a3fcf49bcaa6499e2407ff879d14227 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Wed, 3 Oct 2018 13:38:10 +0200 Subject: irc: Fix mode parsing Ignore unsupported modes, add tests. --- crocoite/test_irc.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 crocoite/test_irc.py (limited to 'crocoite/test_irc.py') diff --git a/crocoite/test_irc.py b/crocoite/test_irc.py new file mode 100644 index 0000000..268c604 --- /dev/null +++ b/crocoite/test_irc.py @@ -0,0 +1,14 @@ +import pytest +from .irc import ArgparseBot + +def test_mode_parse (): + assert ArgparseBot.parseMode ('+a') == [('+', 'a')] + assert ArgparseBot.parseMode ('+ab') == [('+', 'a'), ('+', 'b')] + assert ArgparseBot.parseMode ('+a+b') == [('+', 'a'), ('+', 'b')] + assert ArgparseBot.parseMode ('-a') == [('-', 'a')] + assert ArgparseBot.parseMode ('-ab') == [('-', 'a'), ('-', 'b')] + assert ArgparseBot.parseMode ('-a-b') == [('-', 'a'), ('-', 'b')] + assert ArgparseBot.parseMode ('+a-b') == [('+', 'a'), ('-', 'b')] + assert ArgparseBot.parseMode ('-a+b') == [('-', 'a'), ('+', 'b')] + assert ArgparseBot.parseMode ('-ab+cd') == [('-', 'a'), ('-', 'b'), ('+', 'c'), ('+', 'd')] + -- cgit v1.2.3