Skip to content

Commit 9987179

Browse files
committed
Update unit tests to make flake8 happy
1 parent dacef08 commit 9987179

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
@@ -88,7 +88,7 @@ TEST_SUBMODULE(exceptions, m) {
8888
.def(py::init< std::string, int>())
8989
.def("getErrorCode", &BoundException::errorCode)
9090
.def("getMessage", &BoundException::what)
91-
.def_property_readonly("message", &BoundException::what);
91+
.def("__str__", &BoundException::what);
9292

9393
m.def("throw_std_exception", []() {
9494
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
@@ -156,11 +156,11 @@ def test_bound_exceptions():
156156
try:
157157
m.throws_bound_exception()
158158
except m.BoundException as ex:
159-
assert ex.message == "this error is a class"
159+
assert str(ex) == "this error is a class"
160160
assert ex.getErrorCode() == 42
161161

162162
try:
163163
raise m.BoundException("raising from python", 14)
164164
except m.BoundException as ex:
165-
assert ex.message == "raising from python"
165+
assert str(ex) == "raising from python"
166166
assert ex.getErrorCode() == 14

0 commit comments

Comments
 (0)