Skip to content

Commit

Permalink
fix issue uiri#364 and add a test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
Aplet123 committed Jun 23, 2021
1 parent 3f637db commit e879373
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def test_bug_196():
assert round_trip_bug_dict == bug_dict
assert round_trip_bug_dict['x'] == bug_dict['x']

def test_bug_364():
bug_dict = {"foo": [{"bar": {}, "moot": {"a": 1}}]}
round_trip_bug_dict = toml.loads(toml.dumps(bug_dict))
assert bug_dict == round_trip_bug_dict

def test_valid_tests():
valid_dir = "toml-test/tests/valid/"
Expand Down
4 changes: 2 additions & 2 deletions toml/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ def dump_sections(self, o, sup):
s1, d1 = self.dump_sections(d[dsec], sup +
qsection + "." +
dsec)
arraytabstr += ("[" + sup + qsection +
"." + dsec + "]\n")
if s1:
arraytabstr += ("[" + sup + qsection +
"." + dsec + "]\n")
arraytabstr += s1
for s1 in d1:
newd[dsec + "." + s1] = d1[s1]
Expand Down

0 comments on commit e879373

Please sign in to comment.