Skip to content

Commit 0240995

Browse files
committed
fix: error occurs when trying to get str(array)
Signed-off-by: Frost Ming <[email protected]>
1 parent 18a5277 commit 0240995

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

tests/test_items.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ def test_array_behaves_like_a_list():
307307
content = """a = [1, 2,] # Comment
308308
"""
309309
doc = parse(content)
310+
assert str(doc["a"]) == "[1, 2]"
310311

311312
assert doc["a"] == [1, 2]
312313
doc["a"] += [3, 4]

tomlkit/items.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,9 +1414,6 @@ def __delitem__(self, key: Union[int, slice]):
14141414

14151415
self._reindex()
14161416

1417-
def __str__(self):
1418-
return str([v.value.value for v in self._iter_items() if v.value is not None])
1419-
14201417
def _getstate(self, protocol=3):
14211418
return list(self._iter_items()), self._trivia, self._multiline
14221419

0 commit comments

Comments
 (0)