Skip to content

Commit bdef619

Browse files
committed
Tests: remove now needless "TOML compliance"->"burntsushi" format conversion
1 parent 4089258 commit bdef619

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

tests/burntsushi.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@
77
import datetime
88
from typing import Any
99

10-
# Aliases for converting TOML compliance format [1] to BurntSushi format [2]
11-
# [1] https://github.com/toml-lang/compliance/blob/db7c3211fda30ff9ddb10292f4aeda7e2e10abc4/docs/json-encoding.md # noqa: E501
12-
# [2] https://github.com/BurntSushi/toml-test/blob/4634fdf3a6ecd6aaea5f4cdcd98b2733c2694993/README.md # noqa: E501
13-
_aliases = {
14-
"boolean": "bool",
15-
"offset datetime": "datetime",
16-
"local datetime": "datetime-local",
17-
"local date": "date-local",
18-
"local time": "time-local",
19-
}
20-
2110

2211
def convert(obj):
2312
if isinstance(obj, str):
@@ -53,31 +42,25 @@ def convert(obj):
5342
def normalize(obj: Any) -> Any:
5443
"""Normalize test objects.
5544
56-
This normalizes primitive values (e.g. floats), and also converts from
57-
TOML compliance format [1] to BurntSushi format [2].
58-
59-
[1] https://github.com/toml-lang/compliance/blob/db7c3211fda30ff9ddb10292f4aeda7e2e10abc4/docs/json-encoding.md # noqa: E501
60-
[2] https://github.com/BurntSushi/toml-test/blob/4634fdf3a6ecd6aaea5f4cdcd98b2733c2694993/README.md # noqa: E501
61-
"""
45+
This normalizes primitive values (e.g. floats)."""
6246
if isinstance(obj, list):
6347
return [normalize(item) for item in obj]
6448
if isinstance(obj, dict):
6549
if "type" in obj and "value" in obj:
6650
type_ = obj["type"]
67-
norm_type = _aliases.get(type_, type_)
6851
value = obj["value"]
69-
if norm_type == "float":
52+
if type_ == "float":
7053
norm_value = _normalize_float_str(value)
71-
elif norm_type in {"datetime", "datetime-local"}:
54+
elif type_ in {"datetime", "datetime-local"}:
7255
norm_value = _normalize_datetime_str(value)
73-
elif norm_type == "time-local":
56+
elif type_ == "time-local":
7457
norm_value = _normalize_localtime_str(value)
7558
else:
7659
norm_value = value
7760

78-
if norm_type == "array":
61+
if type_ == "array":
7962
return [normalize(item) for item in value]
80-
return {"type": norm_type, "value": norm_value}
63+
return {"type": type_, "value": norm_value}
8164
return {k: normalize(v) for k, v in obj.items()}
8265
raise AssertionError("Burntsushi fixtures should be dicts/lists only")
8366

0 commit comments

Comments
 (0)