Show More
@@ -14,6 +14,20 b' def test_push():' | |||
|
14 | 14 | np.testing.assert_almost_equal(np.asarray(rm.r('X')), ip.user_ns['X']) |
|
15 | 15 | np.testing.assert_almost_equal(np.asarray(rm.r('Y')), ip.user_ns['Y']) |
|
16 | 16 | |
|
17 | def test_push_localscope(): | |
|
18 | """Test that Rpush looks for variables in the local scope first.""" | |
|
19 | ip.run_cell(''' | |
|
20 | def rmagic_addone(u): | |
|
21 | %Rpush u | |
|
22 | %R result = u+1 | |
|
23 | %Rpull result | |
|
24 | return result[0] | |
|
25 | u = 0 | |
|
26 | result = rmagic_addone(12344) | |
|
27 | ''') | |
|
28 | result = ip.user_ns['result'] | |
|
29 | np.testing.assert_equal(result, 12345) | |
|
30 | ||
|
17 | 31 | def test_pull(): |
|
18 | 32 | rm = rmagic.RMagics(ip) |
|
19 | 33 | rm.r('Z=c(11:20)') |
General Comments 0
You need to be logged in to leave comments.
Login now