Skip to content

Commit ce918c2

Browse files
authored
Merge pull request #2 from flofeurstein/fix-exception-description
fix exception description and test
2 parents 9055cd3 + 2a41d28 commit ce918c2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/durand/object_dictionary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def write(self, index: int, subindex: int, value: Any, downloaded: bool = False)
253253

254254
if variable.maximum is not None and value > variable.maximum:
255255
raise ValueError(
256-
f"Value {value} is too high (minimum is {variable.maximum})"
256+
f"Value {value} is too high (maximum is {variable.maximum})"
257257
)
258258

259259
if multiplexor in self.validate_callbacks:

tests/test_object_dictionary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ def test_write():
2424

2525
node.object_dictionary.write(0x2000, 0, -32768)
2626
assert node.object_dictionary.read(0x2000, 0) == -32768
27-
27+
2828
# test too low value
2929
with pytest.raises(ValueError, match=re.escape('Value -32769 is too low (minimum is -32768)')):
3030
node.object_dictionary.write(0x2000, 0, value=-32769)
3131

3232
# test too high value
33-
with pytest.raises(ValueError, match=re.escape('Value 32768 is too high (minimum is 32767)')):
33+
with pytest.raises(ValueError, match=re.escape('Value 32768 is too high (maximum is 32767)')):
3434
node.object_dictionary.write(0x2000, 0, value=32768)
3535

3636

@@ -41,6 +41,6 @@ def test_access_of_unknown_variable():
4141

4242
with pytest.raises(KeyError):
4343
node.object_dictionary.write(0x2000, 0, 5)
44-
44+
4545
with pytest.raises(KeyError):
4646
node.object_dictionary.read(0x2000, 0)

0 commit comments

Comments
 (0)