summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/tkinter')
-rw-r--r--Lib/tkinter/test/test_ttk/test_widgets.py9
-rw-r--r--Lib/tkinter/ttk.py2
2 files changed, 10 insertions, 1 deletions
diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py
index bbc508d..5b0e29c 100644
--- a/Lib/tkinter/test/test_ttk/test_widgets.py
+++ b/Lib/tkinter/test/test_ttk/test_widgets.py
@@ -1662,6 +1662,15 @@ class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
self.tv.insert('', 'end', text=value), text=None),
value)
+ # test for values which are not None
+ itemid = self.tv.insert('', 'end', 0)
+ self.assertEqual(itemid, '0')
+ itemid = self.tv.insert('', 'end', 0.0)
+ self.assertEqual(itemid, '0.0')
+ # this is because False resolves to 0 and element with 0 iid is already present
+ self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', False)
+ self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', '')
+
def test_selection(self):
self.assertRaises(TypeError, self.tv.selection, 'spam')
diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py
index 490b502..573544d 100644
--- a/Lib/tkinter/ttk.py
+++ b/Lib/tkinter/ttk.py
@@ -1361,7 +1361,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
already exist in the tree. Otherwise, a new unique identifier
is generated."""
opts = _format_optdict(kw)
- if iid:
+ if iid is not None:
res = self.tk.call(self._w, "insert", parent, index,
"-id", iid, *opts)
else: