Skip to content

Commit eac660a

Browse files
committed
tests: Test that callback handles are weak-refable
1 parent ced645a commit eac660a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/test_base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import logging
33
import threading
44
import time
5-
65
import uvloop
76
import unittest
7+
import weakref
88

99
from unittest import mock
1010
from uvloop._testbase import UVTestCase, AIOTestCase
@@ -28,6 +28,11 @@ def test_close(self):
2828
self.assertRaises(RuntimeError, self.loop.run_forever)
2929
self.assertRaises(RuntimeError, self.loop.run_until_complete, f)
3030

31+
def test_handle_weakref(self):
32+
wd = weakref.WeakValueDictionary()
33+
h = self.loop.call_soon(lambda: None)
34+
wd['h'] = h # Would fail without __weakref__ slot.
35+
3136
def test_call_soon(self):
3237
calls = []
3338

0 commit comments

Comments
 (0)