def test_pwx_input_file():
    # defaults: "pwx.in" if `calculation_presets` is not input
    pwig = PwxInputGenerator(crystal_structure=feo_struct)
    assert pwig.pwx_input_file == "pwx.in"
    # default otherwise: "[calculation_presets].in"
    pwig = PwxInputGenerator(crystal_structure=feo_struct,
                             calculation_presets="vc-relax")
    assert pwig.pwx_input_file == "vc-relax.in"
    # or use any user-input file name
    pwig = PwxInputGenerator(crystal_structure=feo_struct)
    pwig.pwx_input_file = "test.in"
    assert pwig.pwx_input_file == "test.in"
def test_write_input_files():
    import tempfile

    _tmp_file = tempfile.NamedTemporaryFile(mode="w", delete=True)
    filename = _tmp_file.name
    write_location = os.path.dirname(filename)
    pwig = PwxInputGenerator(crystal_structure=feo_struct)
    pwig.calculation_presets = "scf"
    pwig.specify_potentials = True
    pwig.custom_sett_dict["pseudo_dir"] = pseudo_dir
    pwig.write_location = write_location
    pwig.pwx_input_file = filename
    pwig.write_input_files()
    with open(filename, "r") as fr:
        assert fr.read() == feo_scf_in.rstrip("\n")