Example #1
0
def test_load(tmp_path, sample_forcing_yaml_content):
    file = tmp_path / FORCING_YAML
    file.write_text(sample_forcing_yaml_content)
    result = load(tmp_path)
    expected = DefaultForcing(
        directory=str(tmp_path),
        start_time="1989-01-02T00:00:00Z",
        end_time="1999-01-02T00:00:00Z",
    )
    assert result == expected
Example #2
0
def test_load_without_yaml(tmp_path):
    with pytest.raises(FileNotFoundError) as excinfo:
        load(tmp_path)
    assert str(tmp_path / FORCING_YAML) in str(excinfo.value)
Example #3
0
    def test_saved_yaml(self, forcing, tmp_path):
        saved_forcing = load(tmp_path)
        # shape should is not included in the yaml file
        forcing.shape = None

        assert forcing == saved_forcing