Skip to content

Commit 42f8b5a

Browse files
committed
Update checkpoint name unit tests
1 parent d20d3d2 commit 42f8b5a

5 files changed

Lines changed: 6 additions & 7 deletions

File tree

bris/model/interpolator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,6 @@ def forward_interp(self, x: torch.Tensor, **kwargs) -> torch.Tensor:
692692
)[self.ds_name_interp]
693693
except AttributeError:
694694
# Backward compatibility with models that do not use kwargs:
695-
x = list(x.values())[0]
696695
try:
697696
return self.interpolator(
698697
x, model_comm_group=self.model_comm_group, **kwargs

tests/test_checkpoints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def test_metadata():
9-
filename = os.path.dirname(os.path.abspath(__file__)) + "/files/checkpoint.ckpt"
9+
filename = os.path.dirname(os.path.abspath(__file__)) + "/files/checkpoint_single.ckpt"
1010
checkpoint = bris.checkpoint.Checkpoint(path=filename)
1111

1212
n2i = {

tests/test_inspect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_get_required_variables():
115115
"skt",
116116
"w_850",
117117
]
118-
checkpoint_simple = bris.checkpoint.Checkpoint("tests/files/checkpoint.ckpt")
118+
checkpoint_simple = bris.checkpoint.Checkpoint("tests/files/checkpoint_single.ckpt")
119119
required_simple = bris.inspect.get_required_variables(checkpoint_simple)["data"]
120120
for var in expected_simple:
121121
assert var in required_simple, (
@@ -143,12 +143,12 @@ def test_get_required_variables():
143143

144144
def test_check_module_versions():
145145
"""This depends on the current venv, so just test it doesn't crash"""
146-
checkpoint = bris.checkpoint.Checkpoint("tests/files/checkpoint.ckpt")
146+
checkpoint = bris.checkpoint.Checkpoint("tests/files/checkpoint_single.ckpt")
147147
_bad = bris.inspect.check_module_versions(checkpoint)
148148

149149
# assert "fsspec==2025.2.0" in bad
150150

151151

152152
def manual_test_inspect():
153153
"""This depends on the current venv, so just test it doesn't crash"""
154-
_status = bris.inspect.inspect(checkpoint_path="tests/files/checkpoint.ckpt")
154+
_status = bris.inspect.inspect(checkpoint_path="tests/files/checkpoint_single.ckpt")

tests/test_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_bris_predictor():
3535
)
3636

3737
checkpoint_path = (
38-
os.path.dirname(os.path.abspath(__file__)) + "/files/checkpoint.ckpt"
38+
os.path.dirname(os.path.abspath(__file__)) + "/files/checkpoint_single.ckpt"
3939
)
4040

4141
# Create test config

tests/test_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,6 @@ def test_add_checkpoint_name_to_attrs():
144144
"variables": ["2t", "2d"],
145145
}
146146
}
147-
test_ckpts = {"testchk": Checkpoint("./tests/files/checkpoint.ckpt")}
147+
test_ckpts = {"testchk": Checkpoint("./tests/files/checkpoint_single.ckpt")}
148148
new_oc = bris.routes.add_checkpoint_name_to_attrs(test_oc, test_ckpts)
149149
assert "testchk" in new_oc["netcdf"]["global_attributes"]["source"]

0 commit comments

Comments
 (0)