##// END OF EJS Templates
Add test for external library linking.
Fernando Perez -
Show More
@@ -15,19 +15,21 b' try:'
15 15 except:
16 16 __test__ = False
17 17
18 ip = get_ipython()
19
20
18 21 def setup():
19 ip = get_ipython()
20 22 ip.extension_manager.load_extension('cythonmagic')
21 23
24
22 25 def test_cython_inline():
23 ip = get_ipython()
24 26 ip.ex('a=10; b=20')
25 27 result = ip.run_cell_magic('cython_inline','','return a+b')
26 28 nt.assert_equals(result, 30)
27 29
30
28 31 def test_cython_pyximport():
29 32 module_name = '_test_cython_pyximport'
30 ip = get_ipython()
31 33 ip.run_cell_magic('cython_pyximport', module_name, code)
32 34 ip.ex('g = f(10)')
33 35 nt.assert_equals(ip.user_ns['g'], 20.0)
@@ -36,12 +38,19 b' def test_cython_pyximport():'
36 38 except OSError:
37 39 pass
38 40
41
39 42 def test_cython():
40 ip = get_ipython()
41 43 ip.run_cell_magic('cython', '', code)
42 44 ip.ex('g = f(10)')
43 45 nt.assert_equals(ip.user_ns['g'], 20.0)
44 46
45 47
46
47
48 def test_extlibs():
49 code = py3compat.str_to_unicode("""
50 from libc.math cimport sin
51 x = sin(0.0)
52 """)
53 ip.user_ns['x'] = 1
54 ip.run_cell_magic('cython', '-l m', code)
55 nt.assert_equals(ip.user_ns['x'], 0)
56
General Comments 0
You need to be logged in to leave comments. Login now