def test_basic_fields(): main = interpreters.get_main() assert main.id == 0 assert main.is_running() is True other = interpreters.create() assert other.id > 0
def test_send_and_recv_on_channel_between_interpreters(): recv, send = interpreters.create_channel() send.send(43) script = f"from backports import interpreters; assert interpreters.RecvChannel({recv.id}).recv() == 43" interpreters.create().run(script)
def test_run(): interp = interpreters.create() interp.run("print('Hello world!')")
def test_destroy(): new = interpreters.create() new.close()
def test_create(): created = interpreters.create() assert isinstance(created, interpreters.Interpreter)