def _test_main():
    import os
    import readline
    import atexit
    # Setup history and readline facility for remote q:
    histfile = os.path.join(os.environ['HOME'], '.pyhistory')
    try:
        readline.read_history_file(histfile)
    except __HOLE__:
        pass
    atexit.register(readline.write_history_file, histfile)

    conn = connect()
    print('"conn" is your handle to rserve. Type e.g. "conn(\'1\')" '
          'for string evaluation.')
    # r('x<-1:20; y<-x*2; lm(y~x)')
    sc = open('../testData/test-script.R').read()
    v = conn.r(sc)
    open('r-test-png.png', 'w').write(v[3])
    conn.r.v = 'abc'
    conn.r('func0 <- function() { 3 }')
    conn.r('func1 <- function(a1) { a1 }')
    conn.r('func2 <- function(a1, a2) { list(a1, a2) }')
    conn.r('funcKW <- function(a1=1, a2=4) { list(a1, a2) }')
    conn.r('squared<-function(t) t^2')
dataset/ETHPy150Open ralhei/pyRserve/pyRserve/rconn.py/_test_main