示例#1
0
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
示例#2
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)
示例#3
0
def test_run():
    interp = interpreters.create()
    interp.run("print('Hello world!')")
示例#4
0
def test_destroy():
    new = interpreters.create()
    new.close()
示例#5
0
def test_create():
    created = interpreters.create()
    assert isinstance(created, interpreters.Interpreter)