Skip to content

Commit 3eeca09

Browse files
committed
Improve name type validation in test_variable_invalid_init for Variable initialization
1 parent e877b1f commit 3eeca09

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/test_particle.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ def test_variable_invalid_init():
2424
with pytest.raises(ValueError, match="to_write must be one of .*\. Got to_write="):
2525
Variable("name", to_write="test")
2626

27-
with pytest.raises(ValueError, match="to_write must be one of .*\. Got to_write="):
28-
Variable("name", to_write="test")
27+
with pytest.raises(TypeError, match="Expected a string for variable name, got int instead."):
28+
Variable(123)
2929

3030
for name in ["a b", "123", "while"]:
31-
with pytest.raises(ValueError, match="Particle variable has to be a valid Python variable name. Got "):
31+
with pytest.raises(ValueError, match=r"Received invalid Python variable name.*"):
3232
Variable(name)
3333

3434
with pytest.raises(ValueError, match="Attributes cannot be set if to_write=False"):

0 commit comments

Comments
 (0)