Add test files (unit and integration tests)
Some checks failed
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.9) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (3.10) (push) Has been cancelled

This commit is contained in:
2026-02-02 10:11:05 +00:00
parent 6c2c810495
commit 1833739df5

View File

@@ -1,11 +1,10 @@
"""Unit tests for log parsers."""
import pytest
from loglens.parsers.base import LogFormat, ParsedLogEntry
from loglens.parsers.apache_parser import ApacheParser
from loglens.parsers.base import LogFormat
from loglens.parsers.factory import ParserFactory
from loglens.parsers.json_parser import JSONParser
from loglens.parsers.syslog_parser import SyslogParser
from loglens.parsers.apache_parser import ApacheParser
from loglens.parsers.factory import ParserFactory
class TestJSONParser:
@@ -29,7 +28,7 @@ class TestJSONParser:
parser = JSONParser()
assert parser.can_parse('{"key": "value"}')
assert parser.can_parse('[1, 2, 3]')
assert parser.can_parse("[1, 2, 3]")
assert not parser.can_parse("not json")
assert not parser.can_parse("")
@@ -120,7 +119,7 @@ class TestApacheParser:
def test_error_log(self):
"""Test parsing Apache error log."""
parser = ApacheParser()
line = '[Sat Jan 15 10:30:00.123456 2024] [mpm_prefork:notice] [pid 1234] AH00163: Apache configured'
line = "[Sat Jan 15 10:30:00.123456 2024] [mpm_prefork:notice] [pid 1234] AH00163: Apache configured"
entry = parser.parse(line, 1)