test_mixed.py 911 B

1234567891011121314151617181920212223242526272829303132333435
  1. import os
  2. import textwrap
  3. import pytest
  4. from numpy.testing import assert_, assert_equal, IS_PYPY
  5. from . import util
  6. def _path(*a):
  7. return os.path.join(*((os.path.dirname(__file__),) + a))
  8. class TestMixed(util.F2PyTest):
  9. sources = [_path('src', 'mixed', 'foo.f'),
  10. _path('src', 'mixed', 'foo_fixed.f90'),
  11. _path('src', 'mixed', 'foo_free.f90')]
  12. def test_all(self):
  13. assert_(self.module.bar11() == 11)
  14. assert_(self.module.foo_fixed.bar12() == 12)
  15. assert_(self.module.foo_free.bar13() == 13)
  16. @pytest.mark.xfail(IS_PYPY,
  17. reason="PyPy cannot modify tp_doc after PyType_Ready")
  18. def test_docstring(self):
  19. expected = textwrap.dedent("""\
  20. a = bar11()
  21. Wrapper for ``bar11``.
  22. Returns
  23. -------
  24. a : int
  25. """)
  26. assert_equal(self.module.bar11.__doc__, expected)