python-poetry / tomlkit

Style-preserving TOML library for Python
MIT License
693 stars 98 forks source link

Table header missing #374

Closed CGamesPlay closed 3 months ago

CGamesPlay commented 3 months ago
>>> import tomlkit
>>> child = tomlkit.table()
>>> child.add(tomlkit.key(("b", "c")), 1)
{'b': {'c': 1}}
>>> tbl = tomlkit.table()
>>> tbl.add("a", child)
{'a': {'b': {'c': 1}}}
>>> tbl.as_string()
'b.c = 1\n'
>>> child.is_super_table()
True

Here the "a" level has been dropped, because child was classified as a super table. Using child = tomlkit.table(False) has the correct behavior.