Coverage for idle_test/test_debugobj.py: 95%
36 statements
« prev ^ index » next coverage.py v7.2.5, created at 2023-05-11 13:22 -0700
« prev ^ index » next coverage.py v7.2.5, created at 2023-05-11 13:22 -0700
1"Test debugobj, coverage 40%."
3from idlelib import debugobj
4import unittest
7class ObjectTreeItemTest(unittest.TestCase):
9 def test_init(self):
10 ti = debugobj.ObjectTreeItem('label', 22) 1b
11 self.assertEqual(ti.labeltext, 'label') 1b
12 self.assertEqual(ti.object, 22) 1b
13 self.assertEqual(ti.setfunction, None) 1b
16class ClassTreeItemTest(unittest.TestCase):
18 def test_isexpandable(self):
19 ti = debugobj.ClassTreeItem('label', 0) 1e
20 self.assertTrue(ti.IsExpandable()) 1e
23class AtomicObjectTreeItemTest(unittest.TestCase):
25 def test_isexpandable(self):
26 ti = debugobj.AtomicObjectTreeItem('label', 0) 1f
27 self.assertFalse(ti.IsExpandable()) 1f
30class SequenceTreeItemTest(unittest.TestCase):
32 def test_isexpandable(self):
33 ti = debugobj.SequenceTreeItem('label', ()) 1c
34 self.assertFalse(ti.IsExpandable()) 1c
35 ti = debugobj.SequenceTreeItem('label', (1,)) 1c
36 self.assertTrue(ti.IsExpandable()) 1c
38 def test_keys(self):
39 ti = debugobj.SequenceTreeItem('label', 'abc') 1g
40 self.assertEqual(list(ti.keys()), [0, 1, 2]) 1g
43class DictTreeItemTest(unittest.TestCase):
45 def test_isexpandable(self):
46 ti = debugobj.DictTreeItem('label', {}) 1d
47 self.assertFalse(ti.IsExpandable()) 1d
48 ti = debugobj.DictTreeItem('label', {1:1}) 1d
49 self.assertTrue(ti.IsExpandable()) 1d
51 def test_keys(self):
52 ti = debugobj.DictTreeItem('label', {1:1, 0:0, 2:2}) 1h
53 self.assertEqual(ti.keys(), [0, 1, 2]) 1h
56if __name__ == '__main__': 56 ↛ 57line 56 didn't jump to line 57, because the condition on line 56 was never true
57 unittest.main(verbosity=2)