test_mixed.py 848 B

123456789101112131415161718192021222324252627282930313233
  1. import os
  2. import textwrap
  3. import pytest
  4. from numpy.testing import IS_PYPY
  5. from . import util
  6. class TestMixed(util.F2PyTest):
  7. sources = [
  8. util.getpath("tests", "src", "mixed", "foo.f"),
  9. util.getpath("tests", "src", "mixed", "foo_fixed.f90"),
  10. util.getpath("tests", "src", "mixed", "foo_free.f90"),
  11. ]
  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 self.module.bar11.__doc__ == expected