test_mixed.py 931 B

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