Show More
@@ -147,7 +147,7 b' class CythonMagics(Magics):' | |||||
147 | "multiple times)." |
|
147 | "multiple times)." | |
148 | ) |
|
148 | ) | |
149 | @magic_arguments.argument( |
|
149 | @magic_arguments.argument( | |
150 |
'-n', '--name', |
|
150 | '-n', '--name', | |
151 | help="Specify a name for the Cython module." |
|
151 | help="Specify a name for the Cython module." | |
152 | ) |
|
152 | ) | |
153 | @magic_arguments.argument( |
|
153 | @magic_arguments.argument( | |
@@ -209,7 +209,7 b' class CythonMagics(Magics):' | |||||
209 | key += time.time(), |
|
209 | key += time.time(), | |
210 |
|
210 | |||
211 | if args.name: |
|
211 | if args.name: | |
212 |
module_name = str(args.name |
|
212 | module_name = str(args.name) | |
213 | else: |
|
213 | else: | |
214 | module_name = "_cython_magic_" + hashlib.md5(str(key).encode('utf-8')).hexdigest() |
|
214 | module_name = "_cython_magic_" + hashlib.md5(str(key).encode('utf-8')).hexdigest() | |
215 | module_path = os.path.join(lib_dir, module_name + self.so_ext) |
|
215 | module_path = os.path.join(lib_dir, module_name + self.so_ext) |
@@ -50,6 +50,14 b' def test_cython():' | |||||
50 | nt.assert_equal(ip.user_ns['g'], 20.0) |
|
50 | nt.assert_equal(ip.user_ns['g'], 20.0) | |
51 |
|
51 | |||
52 |
|
52 | |||
|
53 | def test_cython_name(): | |||
|
54 | # The Cython module named 'mymodule' defines the function f. | |||
|
55 | ip.run_cell_magic('cython', '--name=mymodule', code) | |||
|
56 | # This module can now be imported in the interactive namespace. | |||
|
57 | ip.ex('import mymodule; g = mymodule.f(10)') | |||
|
58 | nt.assert_equal(ip.user_ns['g'], 20.0) | |||
|
59 | ||||
|
60 | ||||
53 | @dec.skip_win32 |
|
61 | @dec.skip_win32 | |
54 | def test_extlibs(): |
|
62 | def test_extlibs(): | |
55 | code = py3compat.str_to_unicode(""" |
|
63 | code = py3compat.str_to_unicode(""" |
General Comments 0
You need to be logged in to leave comments.
Login now