test_abstract_interface.py 832 B

12345678910111213141516171819202122232425
  1. from pathlib import Path
  2. import pytest
  3. import textwrap
  4. from . import util
  5. from numpy.f2py import crackfortran
  6. from numpy.testing import IS_WASM
  7. @pytest.mark.skipif(IS_WASM, reason="Cannot start subprocess")
  8. class TestAbstractInterface(util.F2PyTest):
  9. sources = [util.getpath("tests", "src", "abstract_interface", "foo.f90")]
  10. skip = ["add1", "add2"]
  11. def test_abstract_interface(self):
  12. assert self.module.ops_module.foo(3, 5) == (8, 13)
  13. def test_parse_abstract_interface(self):
  14. # Test gh18403
  15. fpath = util.getpath("tests", "src", "abstract_interface",
  16. "gh18403_mod.f90")
  17. mod = crackfortran.crackfortran([str(fpath)])
  18. assert len(mod) == 1
  19. assert len(mod[0]["body"]) == 1
  20. assert mod[0]["body"][0]["block"] == "abstract interface"