summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-11-07 10:02:31 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-11-07 10:02:31 (GMT)
commit8e92f5727414815fce9a12ded1acfb7e13037e85 (patch)
tree8bbf7b8b5517b71d88cbdea5a058fc579d120523 /Lib/tkinter/test
parent72a7f7c476841dde6977f099cc63807df5858c2d (diff)
downloadcpython-8e92f5727414815fce9a12ded1acfb7e13037e85.zip
cpython-8e92f5727414815fce9a12ded1acfb7e13037e85.tar.gz
cpython-8e92f5727414815fce9a12ded1acfb7e13037e85.tar.bz2
Issue #22769: Fixed ttk.Treeview.tag_has() when called without arguments.
Diffstat (limited to 'Lib/tkinter/test')
-rw-r--r--Lib/tkinter/test/test_ttk/test_widgets.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py
index f73ac79..8a27324 100644
--- a/Lib/tkinter/test/test_ttk/test_widgets.py
+++ b/Lib/tkinter/test/test_ttk/test_widgets.py
@@ -1,6 +1,6 @@
import unittest
import tkinter
-from tkinter import ttk
+from tkinter import ttk, TclError
from test.support import requires
import sys
@@ -1563,6 +1563,21 @@ class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
'blue')
self.assertIsInstance(self.tv.tag_configure('test'), dict)
+ def test_tag_has(self):
+ item1 = self.tv.insert('', 'end', text='Item 1', tags=['tag1'])
+ item2 = self.tv.insert('', 'end', text='Item 2', tags=['tag2'])
+ self.assertRaises(TypeError, self.tv.tag_has)
+ self.assertRaises(TclError, self.tv.tag_has, 'tag1', 'non-existing')
+ self.assertTrue(self.tv.tag_has('tag1', item1))
+ self.assertFalse(self.tv.tag_has('tag1', item2))
+ self.assertFalse(self.tv.tag_has('tag2', item1))
+ self.assertTrue(self.tv.tag_has('tag2', item2))
+ self.assertFalse(self.tv.tag_has('tag3', item1))
+ self.assertFalse(self.tv.tag_has('tag3', item2))
+ self.assertEqual(self.tv.tag_has('tag1'), (item1,))
+ self.assertEqual(self.tv.tag_has('tag2'), (item2,))
+ self.assertEqual(self.tv.tag_has('tag3'), ())
+
@add_standard_options(StandardTtkOptionsTests)
class SeparatorTest(AbstractWidgetTest, unittest.TestCase):