File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 1515from tomlkit ._utils import _utc
1616from tomlkit .api import document
1717from tomlkit .exceptions import NonExistentKey
18+ from tomlkit .toml_document import TOMLDocument
1819
1920
2021def test_document_is_a_dict (example ):
@@ -1187,3 +1188,8 @@ def test_overwrite_out_of_order_table_key():
11871188
11881189"""
11891190 )
1191+
1192+
1193+ def test_set_default_int ():
1194+ with pytest .raises (TypeError ):
1195+ TOMLDocument ().setdefault (4 , 5 )
Original file line number Diff line number Diff line change @@ -380,6 +380,9 @@ def __init__(
380380 sep : str | None = None ,
381381 original : str | None = None ,
382382 ) -> None :
383+ if not isinstance (k , str ):
384+ raise TypeError ("Keys must be strings" )
385+
383386 if t is None :
384387 if not k or any (
385388 c not in string .ascii_letters + string .digits + "-" + "_" for c in k
You can’t perform that action at this time.
0 commit comments