Skip to content

Commit bf84d7b

Browse files
author
Andy Babic
committed
Update tests
1 parent 5c612c4 commit bf84d7b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

tests/test_local.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def run(self):
307307
assert test_local.counter == 6
308308

309309

310-
def test_local_del_swallows_type_error(monkeypatch):
310+
def test_local_clear_swallows_type_error(monkeypatch):
311311
test_local = Local()
312312

313313
blow_up_calls = 0
@@ -319,6 +319,22 @@ def blow_up(self):
319319

320320
monkeypatch.setattr("weakref.WeakSet.__iter__", blow_up)
321321

322-
test_local.__del__()
322+
test_local.clear()
323323

324324
assert blow_up_calls == 1
325+
326+
327+
def test_local_clears_on_deletion(monkeypatch):
328+
test_local = Local()
329+
330+
clear_patched_call_count = 0
331+
332+
def clear_patched(self):
333+
nonlocal clear_patched_call_count
334+
clear_patched_call_count += 1
335+
336+
monkeypatch.setattr(test_local.clear, clear_patched)
337+
338+
del test_local
339+
340+
assert clear_patched_call_count == 1

0 commit comments

Comments
 (0)