Skip to content
Open
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
12 changes: 12 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ def test_bug_196():
assert round_trip_bug_dict == bug_dict
assert round_trip_bug_dict['x'] == bug_dict['x']

def test_bug_314():
data = """12:34:56.1 1
12:34:56.12 12
12:34:56.123 123
12:34:56.1234 1234
12:34:56.12345 12345
12:34:56.123456 123456
12:34:56.1234567 123456"""
for line in data.splitlines():
input_, expected = tuple(line.split(" "))
decoded = toml.loads(f"a={input_}")['a']
assert decoded.microsecond == int(expected)

def test_valid_tests():
valid_dir = "toml-test/tests/valid/"
Expand Down
2 changes: 1 addition & 1 deletion toml/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _getpath(p):
FNFError = IOError


TIME_RE = re.compile(r"([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]{3,6}))?")
TIME_RE = re.compile(r"([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]{1,6}))?")


class TomlDecodeError(ValueError):
Expand Down