Skip to content

Commit b5da6c9

Browse files
authored
Merge pull request #159 from sdispater/feature/super-table
2 parents 50c3790 + 92093fc commit b5da6c9

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## [Unreleased]
4+
5+
### Added
6+
7+
- Add a new argument to `table` API to allow it to be a super table. ([#159](https://github.com/sdispater/tomlkit/pull/159))
8+
39
## [0.8.0] - 2021-12-20
410

511
### Changed

tests/test_api.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,11 @@ def test_item_mixed_aray():
283283
t = tomlkit.item(example)
284284
assert t.as_string().strip() == expected
285285
assert dumps({"x": {"y": example}}).strip() == "[x]\ny = " + expected
286+
287+
288+
def test_build_super_table():
289+
doc = tomlkit.document()
290+
table = tomlkit.table(True)
291+
table.add("bar", {"x": 1})
292+
doc.add("foo", table)
293+
assert doc.as_string() == "[foo.bar]\nx = 1\n"

tomlkit/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ def array(raw: str = None) -> Array:
129129
return value(raw)
130130

131131

132-
def table() -> Table:
133-
return Table(Container(), Trivia(), False)
132+
def table(is_super_table: bool = False) -> Table:
133+
return Table(Container(), Trivia(), False, is_super_table)
134134

135135

136136
def inline_table() -> InlineTable:

0 commit comments

Comments
 (0)