def METHOD_NAME(self):
    # The Cython module named 'mymodule' defines the function f.
    ip = self._ip
    ip.run_cell_magic('cython', '--name=mymodule', code)
    # This module can now be imported in the interactive namespace.
    ip.ex('import mymodule; g = mymodule.f(10)')
    self.assertEqual(ip.user_ns['g'], 20.0)