Skip to content

Commit a0b595b

Browse files
committed
Add more tests
1 parent 0ee6b9a commit a0b595b

File tree

3 files changed

+32
-26
lines changed

3 files changed

+32
-26
lines changed

tests/test_deprecation.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### IMPORTS
2+
### ============================================================================
3+
## Future
4+
from __future__ import annotations
5+
6+
## Standard Library
7+
8+
## Installed
9+
import pytest
10+
11+
## Application
12+
import pythonjsonlogger
13+
14+
15+
### TESTS
16+
### ============================================================================
17+
def test_jsonlogger_deprecated():
18+
with pytest.deprecated_call():
19+
pythonjsonlogger.jsonlogger
20+
return

tests/test_formatters.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
## Application
2121
import pythonjsonlogger
22-
from pythonjsonlogger.core import RESERVED_ATTRS, BaseJsonFormatter
22+
from pythonjsonlogger.core import RESERVED_ATTRS, BaseJsonFormatter, merge_record_extra
2323
from pythonjsonlogger.json import JsonFormatter
2424

2525
if pythonjsonlogger.ORJSON_AVAILABLE:
@@ -79,7 +79,17 @@ def get_traceback_from_exception_followed_by_log_call(env_: LoggingEnvironment)
7979

8080
### TESTS
8181
### ============================================================================
82-
## Common Tests
82+
def test_merge_record_extra():
83+
record = logging.LogRecord(
84+
"name", level=1, pathname="", lineno=1, msg="Some message", args=None, exc_info=None
85+
)
86+
output = merge_record_extra(record, target={"foo": "bar"}, reserved=[])
87+
assert output["foo"] == "bar"
88+
assert output["msg"] == "Some message"
89+
return
90+
91+
92+
## Common Formatter Tests
8393
## -----------------------------------------------------------------------------
8494
@pytest.mark.parametrize("class_", ALL_FORMATTERS)
8595
def test_default_format(env: LoggingEnvironment, class_: type[BaseJsonFormatter]):

tests/test_jsonlogger.py

-24
This file was deleted.

0 commit comments

Comments
 (0)