コード例 #1
0
def test_accumulate_basename():
    """When two (or more) parfiles are passed, the filelist:base_filename should be special-cased"""
    namelist_base = f90nml.read(blast_wave_parfile)
    namelist_update = f90nml.read(modifier_parfile)

    namelist_tot1 = read_amrvac_namelist([blast_wave_parfile, modifier_parfile])
    namelist_tot2 = deepcopy(namelist_base)
    namelist_tot2.patch(namelist_update)

    # remove and store the special-case value
    name1 = namelist_tot1["filelist"].pop("base_filename")
    name2 = namelist_tot2["filelist"].pop("base_filename")

    assert name1 == namelist_base["filelist"]["base_filename"] + namelist_update["filelist"]["base_filename"]
    assert name2 == namelist_update["filelist"]["base_filename"]
    assert name1 != name2

    # test equality for the rest of the namelist
    assert namelist_tot1 == namelist_tot2
コード例 #2
0
def test_read_one_file():
    """when provided a single file, the function should merely act as a wrapper for f90nml.read()"""
    namelist1 = read_amrvac_namelist(blast_wave_parfile)
    namelist2 = f90nml.read(blast_wave_parfile)
    assert namelist1 == namelist2
コード例 #3
0
def test_read_pathlike():
    read_amrvac_namelist(Path(blast_wave_parfile))