Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to

### Fixed

- Fix leaked file handles in tests using context managers ([b66a6f5], [#25])
- Fix typo in test name: `test_l9events_form_ip4scout` ->
`test_l9events_from_ip4scout` ([0d8736e], [#27])

Expand Down Expand Up @@ -150,6 +151,7 @@ and this project adheres to

<!-- Commit links -->

[b66a6f5]: https://github.com/LeakIX/l9format-python/commit/b66a6f5
[3547e22]: https://github.com/LeakIX/l9format-python/commit/3547e22
[1ca6e4d]: https://github.com/LeakIX/l9format-python/commit/1ca6e4d
[0d8736e]: https://github.com/LeakIX/l9format-python/commit/0d8736e
Expand Down Expand Up @@ -218,4 +220,5 @@ and this project adheres to
[#22]: https://github.com/LeakIX/l9format-python/issues/22
[#27]: https://github.com/LeakIX/l9format-python/issues/27
[#33]: https://github.com/LeakIX/l9format-python/issues/33
[#25]: https://github.com/LeakIX/l9format-python/issues/25
[#35]: https://github.com/LeakIX/l9format-python/issues/35
12 changes: 7 additions & 5 deletions tests/test_l9format.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import json
import os
from pathlib import Path

from l9format import L9Event

TESTS_DIR = Path(os.path.dirname(__file__))
TESTS_DIR = Path(__file__).parent

IP4SCOUT_FILES = [
f
Expand All @@ -15,13 +14,15 @@

def test_l9event_json_from_reference_repository():
path = TESTS_DIR / "l9event.json"
c = json.load(open(str(path), "r"))
with open(path) as f:
c = json.load(f)
L9Event.from_dict(c)


def test_l9events_from_ip4scout():
for path in IP4SCOUT_FILES:
c = json.load(open(str(path), "r"))
with open(path) as f:
c = json.load(f)
L9Event.from_dict(c)


Expand All @@ -33,7 +34,8 @@ def test_iso8601_nanosecond_parsing():
correctly in Python 3.11+.
"""
path = TESTS_DIR / "l9event.json"
c = json.load(open(str(path), "r"))
with open(path) as f:
c = json.load(f)
# Use a timestamp with nanosecond precision (9 decimal places)
c["time"] = "2023-10-05T23:30:36.823867784Z"
event = L9Event.from_dict(c)
Expand Down