Skip to content

Commit

Permalink
fix: error occurs when trying to get str(array)
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed Mar 27, 2023
1 parent 18a5277 commit 0240995
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions tests/test_items.py
Expand Up @@ -307,6 +307,7 @@ def test_array_behaves_like_a_list():
content = """a = [1, 2,] # Comment
"""
doc = parse(content)
assert str(doc["a"]) == "[1, 2]"

assert doc["a"] == [1, 2]
doc["a"] += [3, 4]
Expand Down
3 changes: 0 additions & 3 deletions tomlkit/items.py
Expand Up @@ -1414,9 +1414,6 @@ def __delitem__(self, key: Union[int, slice]):

self._reindex()

def __str__(self):
return str([v.value.value for v in self._iter_items() if v.value is not None])

def _getstate(self, protocol=3):
return list(self._iter_items()), self._trivia, self._multiline

Expand Down

0 comments on commit 0240995

Please sign in to comment.