MCPcopy Create free account
hub / github.com/numpy/numpy / test_lower_sig

Function test_lower_sig

numpy/f2py/tests/test_f2py2e.py:384–420  ·  view source on GitHub ↗

Lowers cases in signature files by flag or when -h is present CLI :: --[no-]lower -h

(capfd, hello_world_f77, monkeypatch)

Source from the content-addressed store, hash-verified

382
383
384def test_lower_sig(capfd, hello_world_f77, monkeypatch):
385 """Lowers cases in signature files by flag or when -h is present
386
387 CLI :: --[no-]lower -h
388 """
389 foutl = get_io_paths(hello_world_f77, mname="test")
390 ipath = foutl.finp
391 # Signature files
392 capshi = re.compile(r"Block: HI")
393 capslo = re.compile(r"Block: hi")
394 # Case I: --lower is implied by -h
395 # TODO: Clean up to prevent passing --overwrite-signature
396 monkeypatch.setattr(
397 sys,
398 "argv",
399 f'f2py {ipath} -h {foutl.pyf} -m test --overwrite-signature'.split(),
400 )
401
402 with util.switchdir(ipath.parent):
403 f2pycli()
404 out, _ = capfd.readouterr()
405 assert capslo.search(out) is not None
406 assert capshi.search(out) is None
407
408 # Case II: --no-lower overrides -h
409 monkeypatch.setattr(
410 sys,
411 "argv",
412 f'f2py {ipath} -h {foutl.pyf} -m test --overwrite-signature --no-lower'
413 .split(),
414 )
415
416 with util.switchdir(ipath.parent):
417 f2pycli()
418 out, _ = capfd.readouterr()
419 assert capslo.search(out) is None
420 assert capshi.search(out) is not None
421
422
423def test_build_dir(capfd, hello_world_f90, monkeypatch):

Callers

nothing calls this directly

Calls 3

get_io_pathsFunction · 0.85
compileMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected