Skip to content

Commit 62923a6

Browse files
committed
chore: parse json attributes in json_args test
1 parent 1d5ac69 commit 62923a6

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

tests/test_json_args.py

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ class Order(IntEnum):
14311431
with_order_inner=root_with_order.root,
14321432
)
14331433

1434-
assert exporter.exported_spans_as_dict() == [
1434+
assert exporter.exported_spans_as_dict(parse_json_attributes=True) == [
14351435
{
14361436
'name': 'hi',
14371437
'context': {'trace_id': 1, 'span_id': 1, 'is_remote': False},
@@ -1446,7 +1446,7 @@ class Order(IntEnum):
14461446
'code.filepath': 'test_json_args.py',
14471447
'code.function': 'test_pydantic_root_model',
14481448
'code.lineno': 123,
1449-
'with_model': '{"name":"with_model"}',
1449+
'with_model': {'name': 'with_model'},
14501450
# the model's string literal will be wrapped in single quotes to ensure it's logged properly on parsing
14511451
'with_str': '"with_str"',
14521452
'with_str_inner': 'with_str',
@@ -1463,7 +1463,40 @@ class Order(IntEnum):
14631463
'with_color_inner': '"RED"',
14641464
'with_order': '1',
14651465
'with_order_inner': '1',
1466-
'logfire.json_schema': '{"type":"object","properties":{"with_model":{"type":"object","title":"Model","x-python-datatype":"PydanticModel"},"with_str":{"type":"string","x-python-datatype":"string"},"with_str_inner":{},"with_int":{"type":"integer","x-python-datatype":"number"},"with_int_inner":{},"with_float":{"type":"number","x-python-datatype":"number"},"with_float_inner":{},"with_bool":{"type":"boolean","x-python-datatype":null},"with_bool_inner":{},"with_none":{"type":"null"},"with_none_inner":{"type":"null"},"with_color":{"type":"string","x-python-datatype":"string","title":"Color"},"with_color_inner":{"type":"string","title":"Color","x-python-datatype":"Enum","enum":["RED"]},"with_order":{"type":"integer","x-python-datatype":"number","title":"Order"},"with_order_inner":{"type":"integer","title":"Order","x-python-datatype":"Enum","enum":[1]}}}',
1466+
'logfire.json_schema': {
1467+
'type': 'object',
1468+
'properties': {
1469+
'with_model': {
1470+
'type': 'object',
1471+
'title': 'Model',
1472+
'x-python-datatype': 'PydanticModel',
1473+
},
1474+
'with_str': {'type': 'string', 'x-python-datatype': 'string'},
1475+
'with_str_inner': {},
1476+
'with_int': {'type': 'integer', 'x-python-datatype': 'number'},
1477+
'with_int_inner': {},
1478+
'with_float': {'type': 'number', 'x-python-datatype': 'number'},
1479+
'with_float_inner': {},
1480+
'with_bool': {'type': 'boolean', 'x-python-datatype': None},
1481+
'with_bool_inner': {},
1482+
'with_none': {'type': 'null'},
1483+
'with_none_inner': {'type': 'null'},
1484+
'with_color': {'type': 'string', 'x-python-datatype': 'string', 'title': 'Color'},
1485+
'with_color_inner': {
1486+
'type': 'string',
1487+
'title': 'Color',
1488+
'x-python-datatype': 'Enum',
1489+
'enum': ['RED'],
1490+
},
1491+
'with_order': {'type': 'integer', 'x-python-datatype': 'number', 'title': 'Order'},
1492+
'with_order_inner': {
1493+
'type': 'integer',
1494+
'title': 'Order',
1495+
'x-python-datatype': 'Enum',
1496+
'enum': [1],
1497+
},
1498+
},
1499+
},
14671500
},
14681501
}
14691502
]

0 commit comments

Comments
 (0)