(self)
| 232 | |
| 233 | @support.cpython_only |
| 234 | def test_proxy_repr(self): |
| 235 | obj = C() |
| 236 | ref = weakref.proxy(obj, self.callback) |
| 237 | regex = ( |
| 238 | rf"<weakproxy at 0x[0-9a-fA-F]+; " |
| 239 | rf"to '{'' if __name__ == '__main__' else C.__module__ + '.'}{C.__qualname__}' " |
| 240 | rf"at 0x[0-9a-fA-F]+>" |
| 241 | ) |
| 242 | self.assertRegex(repr(ref), regex) |
| 243 | |
| 244 | obj = None |
| 245 | gc_collect() |
| 246 | self.assertRegex(repr(ref), |
| 247 | rf'<weakproxy at 0x[0-9a-fA-F]+; dead>') |
| 248 | |
| 249 | def check_basic_ref(self, factory): |
| 250 | o = factory() |
nothing calls this directly
no test coverage detected