Skip to content

Commit 78c3690

Browse files
committed
fix self-documenting f-string unsupported in torchscript
1 parent 2549457 commit 78c3690

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/models/test_soft_sphere.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ def test_matrix_symmetry_validation(matrix_name: str, matrix: torch.Tensor) -> N
327327
# Replace one matrix with the non-symmetric version
328328
params[matrix_name] = matrix
329329

330-
# Should raise AssertionError due to asymmetric matrix
331-
with pytest.raises(AssertionError):
330+
# Should raise ValueError due to asymmetric matrix
331+
with pytest.raises(ValueError, match="is not symmetric"):
332332
ss.SoftSphereMultiModel(**params)
333333

334334

torch_sim/neighbors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def primitive_neighbor_list( # noqa: C901, PLR0915
110110
]
111111
)
112112
if face_dist_c.shape != (3,):
113-
raise ValueError(f"{face_dist_c.shape=} != (3,)")
113+
raise ValueError(f"face_dist_c.shape={face_dist_c.shape} != (3,)")
114114

115115
# we don't handle other fancier cutoffs
116116
max_cutoff: torch.Tensor = cutoff
@@ -216,9 +216,9 @@ def primitive_neighbor_list( # noqa: C901, PLR0915
216216

217217
# Make sure that all atoms have been sorted into bins.
218218
if len(atom_i) != 0:
219-
raise ValueError(f"{len(atom_i)=} != 0")
219+
raise ValueError(f"len(atom_i)={len(atom_i)} != 0")
220220
if len(bin_index_i) != 0:
221-
raise ValueError(f"{len(bin_index_i)=} != 0")
221+
raise ValueError(f"len(bin_index_i)={len(bin_index_i)} != 0")
222222

223223
# Now we construct neighbor pairs by pairing up all atoms within a bin or
224224
# between bin and neighboring bin. atom_pairs_pn is a helper buffer that

0 commit comments

Comments
 (0)