(self)
| 1020 | type(depickled_clsdict_meth) is type(clsdict_staticmethod) |
| 1021 | |
| 1022 | def test_tornado_coroutine(self): |
| 1023 | # Pickling a locally defined coroutine function |
| 1024 | gen = pytest.importorskip("tornado.gen") |
| 1025 | ioloop = pytest.importorskip("tornado.ioloop") |
| 1026 | |
| 1027 | @gen.coroutine |
| 1028 | def f(x, y): |
| 1029 | yield gen.sleep(x) |
| 1030 | raise gen.Return(y + 1) |
| 1031 | |
| 1032 | @gen.coroutine |
| 1033 | def g(y): |
| 1034 | res = yield f(0.01, y) # noqa: F821 |
| 1035 | raise gen.Return(res + 1) |
| 1036 | |
| 1037 | with pytest.warns(DeprecationWarning): |
| 1038 | assert cloudpickle.is_tornado_coroutine(g) |
| 1039 | |
| 1040 | data = cloudpickle.dumps([g, g], protocol=self.protocol) |
| 1041 | del f, g |
| 1042 | g2, g3 = pickle.loads(data) |
| 1043 | assert g2 is g3 |
| 1044 | loop = ioloop.IOLoop(make_current=False) |
| 1045 | res = loop.run_sync(functools.partial(g2, 5)) |
| 1046 | assert res == 7 |
| 1047 | |
| 1048 | @pytest.mark.skipif( |
| 1049 | (3, 11, 0, "beta") <= sys.version_info < (3, 11, 0, "beta", 4), |
nothing calls this directly
no outgoing calls
no test coverage detected