def test_types(): rs = session.RSession() rs.run("mylist = c(1,2)") assert all(rs.mylist == np.array([1, 2])) rs.run("mybool = TRUE") assert rs.mybool is True rs.run("mystr = 'this'") assert rs.mystr == "this" rs.run("myint = 1") assert rs.myint == 1 rs.run("myfloat = 1.2") assert rs.myfloat == 1.2 rs.run("mynone = NA") assert rs.mynone is None rs.run("mynan = NaN") assert rs.mynan is np.nan rs.run("mynan = Inf") assert rs.mynan is np.inf
def test_session(): sess = session.RSession() sess.get_version() try: sess.reconnect() assert False except: assert True
def test_attribute(): s = session.RSession() s.run("b=1") assert 1 == s.b try: s.c assert False except: assert True assert 1 == s.b