poezio/test/test_logger.py

16 lines
523 B
Python
Raw Normal View History

2017-09-27 22:57:17 +00:00
"""
Test the functions in the `logger` module
"""
2017-10-14 11:00:42 +00:00
from poezio.logger import LogMessage, parse_log_line
2017-09-27 22:57:17 +00:00
def test_parse_message():
line = 'MR 20170909T09:09:09Z 000 <nick>  body'
assert vars(parse_log_line(line)) == vars(LogMessage('2017', '09', '09', '09', '09', '09', '0', 'nick', 'body'))
2017-09-27 22:57:17 +00:00
line = '<>'
assert parse_log_line(line) == None
2017-09-27 22:57:17 +00:00
line = 'MR 20170908T07:05:04Z 003 <nick>  '
assert vars(parse_log_line(line)) == vars(LogMessage('2017', '09', '08', '07', '05', '04', '003', 'nick', ''))