def test_log_line_formatted(data, colorized, expect_error, expected): line = json.dumps(data) record = quteprocess.LogLine(line) record.expected = expect_error ts = datetime.datetime.fromtimestamp(data['created']).strftime('%H:%M:%S') expected = expected.format(timestamp=ts) assert record.formatted_str(colorized=colorized) == expected
def test_log_line_no_match(pytestconfig): with pytest.raises(testprocess.InvalidLine): quteprocess.LogLine(pytestconfig, "Hello World!")
def test_log_line_parse(pytestconfig, data, attrs): line = quteprocess.LogLine(pytestconfig, data) for name, expected in attrs.items(): actual = getattr(line, name) assert actual == expected, name