We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
__missing__
1 parent e17b229 commit 2bc82afCopy full SHA for 2bc82af
Lib/test/test_defaultdict.py
@@ -195,13 +195,16 @@ def default_factory():
195
nonlocal count
196
nonlocal test_dict
197
count += 1
198
+ local_count = count
199
if count == 1:
- test_dict[key] = "set_value"
200
- return "default_factory_value"
+ test_dict[key]
201
+ return local_count
202
203
test_dict = defaultdict(default_factory)
204
- self.assertEqual(test_dict[key], "set_value")
205
+ self.assertEqual(count, 0)
206
+ self.assertEqual(test_dict[key], 2)
207
+ self.assertEqual(count, 2)
208
209
if __name__ == "__main__":
210
unittest.main()
0 commit comments