def METHOD_NAME(conn):
    cur = conn.cursor()
    ensure_table(cur, sample_tabledef)
    with pytest.raises(e.QueryCanceled):
        with cur.copy("copy copy_in from stdin with binary") as copy:
            copy.write(sample_text.decode())
    assert conn.info.transaction_status == conn.TransactionStatus.INERROR