python-poetry / tomlkit

Style-preserving TOML library for Python
MIT License
701 stars 99 forks source link

Table header missing #374

Closed CGamesPlay closed 3 months ago

CGamesPlay commented 4 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.