MCPcopy Index your code
hub / github.com/numpy/numpy / test_lower_sig

Function test_lower_sig

numpy/f2py/tests/test_f2py2e.py:406–442  ·  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

404
405
406def test_lower_sig(capfd, hello_world_f77, monkeypatch):
407 """Lowers cases in signature files by flag or when -h is present
408
409 CLI :: --[no-]lower -h
410 """
411 foutl = get_io_paths(hello_world_f77, mname="test")
412 ipath = foutl.finp
413 # Signature files
414 capshi = re.compile(r"Block: HI")
415 capslo = re.compile(r"Block: hi")
416 # Case I: --lower is implied by -h
417 # TODO: Clean up to prevent passing --overwrite-signature
418 monkeypatch.setattr(
419 sys,
420 "argv",
421 f'f2py {ipath} -h {foutl.pyf} -m test --overwrite-signature'.split(),
422 )
423
424 with util.switchdir(ipath.parent):
425 f2pycli()
426 out, _ = capfd.readouterr()
427 assert capslo.search(out) is not None
428 assert capshi.search(out) is None
429
430 # Case II: --no-lower overrides -h
431 monkeypatch.setattr(
432 sys,
433 "argv",
434 f'f2py {ipath} -h {foutl.pyf} -m test --overwrite-signature --no-lower'
435 .split(),
436 )
437
438 with util.switchdir(ipath.parent):
439 f2pycli()
440 out, _ = capfd.readouterr()
441 assert capslo.search(out) is None
442 assert capshi.search(out) is not None
443
444
445def test_build_dir(capfd, hello_world_f90, monkeypatch):

Callers

nothing calls this directly

Calls 3

get_io_pathsFunction · 0.85
splitMethod · 0.80
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…