Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 13, 2023
1 parent 449fa4a commit dc72f65
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
import unittest

from . import tomltest, tomllib
from . import tomllib, tomltest


class MissingFile:
Expand Down
7 changes: 4 additions & 3 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from . import tomllib


class TestMiscellaneous(unittest.TestCase):
def test_load(self):
content = "one=1 \n two='two' \n arr=[]"
Expand Down Expand Up @@ -101,9 +102,9 @@ def test_inline_table_recursion_limit(self):

def test_truncate_sub_seconds(self):
for t in [
't = 2012-12-12T00:00:00.99999999999999Z',
't = 2012-12-12T00:00:00.99999999999999',
't = 00:00:00.99999999999999',
"t = 2012-12-12T00:00:00.99999999999999Z",
"t = 2012-12-12T00:00:00.99999999999999",
"t = 00:00:00.99999999999999",
]:
obj = tomllib.loads(t)
self.assertEqual(obj["t"].microsecond, 999999)
9 changes: 6 additions & 3 deletions tests/tomltest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
# Licensed to PSF under a Contributor Agreement.

"""Utilities for https://github.com/toml-lang/toml-test"""
"""Utilities for https://github.com/toml-lang/toml-test."""

import datetime
from typing import Any
Expand Down Expand Up @@ -37,7 +37,7 @@ def convert(obj): # noqa: C901

def normalize(obj: Any) -> Any:
"""Normalize test objects; all values are strings, so make sure they're
compared consistently. """
compared consistently."""
if isinstance(obj, list):
return [normalize(item) for item in obj]
elif isinstance(obj, dict) and "type" not in obj and "value" not in obj:
Expand Down Expand Up @@ -92,9 +92,12 @@ def _normalize_float_str(float_str: str) -> str:

return str(as_float)

if __name__ == '__main__':

if __name__ == "__main__":
import json
import sys

import tomli

t = tomli.loads(sys.stdin.read())
print(json.dumps(convert(t)))

0 comments on commit dc72f65

Please sign in to comment.