mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 12:12:53 +01:00
Add in userhost-split tests from ircdocs/parser-tests
This commit is contained in:
parent
01705f8393
commit
fe4bea2948
@ -59,6 +59,19 @@ class MessageParserTest(unittest.TestCase):
|
||||
self.assertEqual(atoms['tags'], IRCCommonProtocol.parse_message_tags(inp.split(" ")),
|
||||
"Parse test failed for message tags: %r" % inp)
|
||||
|
||||
def testUserHostSplit(self):
|
||||
for test in self.USER_HOST_SPLIT_TEST_DATA['tests']:
|
||||
inp = test['source']
|
||||
atoms = test['atoms']
|
||||
|
||||
with self.subTest():
|
||||
if 'nick' not in atoms or 'user' not in atoms or 'host' not in atoms:
|
||||
# Trying to parse a hostmask with missing atoms is an error in split_hostmask()
|
||||
with self.assertRaises(ValueError):
|
||||
utils.split_hostmask(inp)
|
||||
else:
|
||||
expected = [atoms['nick'], atoms['user'], atoms['host']]
|
||||
self.assertEqual(expected, utils.split_hostmask(inp))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user