Skip to content

Commit 23e7030

Browse files
committed
Update unit tests to make flake8 happy
1 parent 1da4bf0 commit 23e7030

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/test_exceptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ TEST_SUBMODULE(exceptions, m) {
105105
.def(py::init< std::string, int>())
106106
.def("getErrorCode", &BoundException::errorCode)
107107
.def("getMessage", &BoundException::what)
108-
.def_property_readonly("message", &BoundException::what);
108+
.def("__str__", &BoundException::what);
109109

110110
m.def("throw_std_exception", []() {
111111
throw std::runtime_error("This exception was intentionally thrown.");

tests/test_exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,11 @@ def test_bound_exceptions():
196196
try:
197197
m.throws_bound_exception()
198198
except m.BoundException as ex:
199-
assert ex.message == "this error is a class"
199+
assert str(ex) == "this error is a class"
200200
assert ex.getErrorCode() == 42
201201

202202
try:
203203
raise m.BoundException("raising from python", 14)
204204
except m.BoundException as ex:
205-
assert ex.message == "raising from python"
205+
assert str(ex) == "raising from python"
206206
assert ex.getErrorCode() == 14

0 commit comments

Comments
 (0)