Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #364 and add a test for it #367

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
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