-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #644 from TotallyNotRobots/missing-mode-info
Handle missing mode info for a mode
- Loading branch information
Showing
5 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from cloudbot.util import irc | ||
|
||
|
||
def test_mode_parse(): | ||
mode_info = { | ||
"a": irc.ChannelMode(character="a", type=irc.ModeType.A), | ||
"d": irc.StatusMode.make("^", "d", 3), | ||
} | ||
parsed = irc.parse_mode_string("+ad", ["foo", "bar"], mode_info) | ||
|
||
assert parsed == [ | ||
irc.ModeChange("a", True, "foo", mode_info["a"]), | ||
irc.ModeChange("d", True, "bar", mode_info["d"]), | ||
] | ||
|
||
|
||
def test_mode_parse_missing_mode(): | ||
mode_info = { | ||
"a": irc.ChannelMode(character="a", type=irc.ModeType.A), | ||
"d": irc.StatusMode.make("^", "d", 3), | ||
} | ||
parsed = irc.parse_mode_string("+adx", ["foo", "bar"], mode_info) | ||
|
||
assert parsed == [ | ||
irc.ModeChange("a", True, "foo", mode_info["a"]), | ||
irc.ModeChange("d", True, "bar", mode_info["d"]), | ||
irc.ModeChange("x", True, None, None), | ||
] | ||
|
||
assert [m.is_status for m in parsed] == [False, True, False] |