Skip to content

Commit

Permalink
Black
Browse files Browse the repository at this point in the history
  • Loading branch information
manishvenu committed Nov 20, 2024
1 parent 37a4566 commit c313811
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
25 changes: 15 additions & 10 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@ def test_write_config(tmp_path):

## Place where all your input files go
input_dir = Path(
os.path.join(tmp_path,
os.path.join(
tmp_path,
expt_name,
"inputs",
)
)

## Directory where you'll run the experiment from
run_dir = Path(
os.path.join(tmp_path,
os.path.join(
tmp_path,
expt_name,
"run_files",
)
)
data_path = Path(tmp_path/"data")
data_path = Path(tmp_path / "data")
for path in (run_dir, input_dir, data_path):
os.makedirs(str(path), exist_ok=True)

Expand All @@ -49,7 +51,7 @@ def test_write_config(tmp_path):
expt_name="test",
boundaries=["south", "north"],
)
config_dict = expt.write_config_file(tmp_path/"testing_config.json")
config_dict = expt.write_config_file(tmp_path / "testing_config.json")
assert config_dict["longitude_extent"] == tuple(longitude_extent)
assert config_dict["latitude_extent"] == tuple(latitude_extent)
assert config_dict["date_range"] == date_range
Expand Down Expand Up @@ -91,20 +93,22 @@ def test_load_config(tmp_path):

## Place where all your input files go
input_dir = Path(
os.path.join(tmp_path,
os.path.join(
tmp_path,
expt_name,
"inputs",
)
)

## Directory where you'll run the experiment from
run_dir = Path(
os.path.join(tmp_path,
os.path.join(
tmp_path,
expt_name,
"run_files",
)
)
data_path = Path(tmp_path/"data")
data_path = Path(tmp_path / "data")
for path in (run_dir, input_dir, data_path):
os.makedirs(str(path), exist_ok=True)

Expand All @@ -122,9 +126,11 @@ def test_load_config(tmp_path):
mom_input_dir=input_dir,
toolpath_dir="",
)
path = os.path.join(tmp_path,"testing_config.json")
path = os.path.join(tmp_path, "testing_config.json")
config_expt = expt.write_config_file(path)
new_expt = rmom6.create_experiment_from_config(os.path.join(path), mom_input_folder=tmp_path, mom_run_folder=tmp_path)
new_expt = rmom6.create_experiment_from_config(
os.path.join(path), mom_input_folder=tmp_path, mom_run_folder=tmp_path
)
assert str(new_expt) == str(expt)
print(new_expt.vgrid)
print(expt.vgrid)
Expand All @@ -136,4 +142,3 @@ def test_load_config(tmp_path):
assert os.path.exists(new_expt.mom_input_dir / "hgrid.nc") & os.path.exists(
new_expt.mom_input_dir / "vcoord.nc"
)

19 changes: 11 additions & 8 deletions tests/test_manish_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def dummy_bathymetry_data():


class TestAll:

@pytest.fixture(scope="module")
def full_legit_expt_setup(self, dummy_bathymetry_data, tmp_path):

Expand All @@ -167,20 +167,22 @@ def full_legit_expt_setup(self, dummy_bathymetry_data, tmp_path):

## Place where all your input files go
input_dir = Path(
os.path.join(tmp_path,
os.path.join(
tmp_path,
expt_name,
"inputs",
)
)

## Directory where you'll run the experiment from
run_dir = Path(
os.path.join(tmp_path,
os.path.join(
tmp_path,
expt_name,
"run_files",
)
)
data_path = Path(tmp_path/"data")
data_path = Path(tmp_path / "data")
for path in (run_dir, input_dir, data_path):
os.makedirs(str(path), exist_ok=True)
bathy_path = data_path / "bathymetry.nc"
Expand Down Expand Up @@ -212,20 +214,22 @@ def test_full_legit_expt_setup(self, tmp_path, dummy_bathymetry_data):

## Place where all your input files go
input_dir = Path(
os.path.join(tmp_path,
os.path.join(
tmp_path,
expt_name,
"inputs",
)
)

## Directory where you'll run the experiment from
run_dir = Path(
os.path.join(tmp_path,
os.path.join(
tmp_path,
expt_name,
"run_files",
)
)
data_path = Path(tmp_path/"data")
data_path = Path(tmp_path / "data")
for path in (run_dir, input_dir, data_path):
os.makedirs(str(path), exist_ok=True)
bathy_path = data_path / "bathymetry.nc"
Expand All @@ -247,7 +251,6 @@ def test_full_legit_expt_setup(self, tmp_path, dummy_bathymetry_data):
)
assert str(expt)


def test_tides(self, dummy_tidal_data, tmp_path):
"""
Test the main setup tides function!
Expand Down

0 comments on commit c313811

Please sign in to comment.