#159: virtual function dispatch has problems with similar-named functions
(msg)
| 243 | |
| 244 | |
| 245 | def test_dispatch_issue(msg): |
| 246 | """#159: virtual function dispatch has problems with similar-named functions""" |
| 247 | |
| 248 | class PyClass1(m.DispatchIssue): |
| 249 | def dispatch(self): |
| 250 | return "Yay.." |
| 251 | |
| 252 | class PyClass2(m.DispatchIssue): |
| 253 | def dispatch(self): |
| 254 | with pytest.raises(RuntimeError) as excinfo: |
| 255 | super().dispatch() |
| 256 | assert ( |
| 257 | msg(excinfo.value) |
| 258 | == 'Tried to call pure virtual function "Base::dispatch"' |
| 259 | ) |
| 260 | |
| 261 | return m.dispatch_issue_go(PyClass1()) |
| 262 | |
| 263 | b = PyClass2() |
| 264 | assert m.dispatch_issue_go(b) == "Yay.." |
| 265 | |
| 266 | |
| 267 | def test_recursive_dispatch_issue(): |