gh-103737: IDLE - Remove unneeded .keys() for dict iteration (#110960)

Add comments where .keys() is needed.
Leave debugger usages along because situation is unclear as indicated in expanded comment.
Most testing is manual.
This commit is contained in:
Terry Jan Reedy 2023-10-18 04:14:52 -04:00 committed by GitHub
parent 77dbd95609
commit baefbb21d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 26 deletions

View file

@ -37,7 +37,7 @@ class SequenceTreeItemTest(unittest.TestCase):
def test_keys(self):
ti = debugobj.SequenceTreeItem('label', 'abc')
self.assertEqual(list(ti.keys()), [0, 1, 2])
self.assertEqual(list(ti.keys()), [0, 1, 2]) # keys() is a range.
class DictTreeItemTest(unittest.TestCase):
@ -50,7 +50,7 @@ class DictTreeItemTest(unittest.TestCase):
def test_keys(self):
ti = debugobj.DictTreeItem('label', {1:1, 0:0, 2:2})
self.assertEqual(ti.keys(), [0, 1, 2])
self.assertEqual(ti.keys(), [0, 1, 2]) # keys() is a sorted list.
if __name__ == '__main__':