Open TiborVoelcker opened 3 weeks ago
may be:
<!-- name: test_raises; raises: (ZeroDivisionError, ValueError) -->
```python
1 / 0
I just don't understand how this is better than a hidden code block, you can of course make the indent parameter so that it moves the code 4 spaces to the right, for example, so that the code is not so scary, but it seems to me that it is better to write a comment to the user that an exception is being handled in this place
may be:
<!-- name: test_raises; raises: (ZeroDivisionError, ValueError) --> ```python 1 / 0
I like this syntax. But it might be worthwhile to make it more general for other use cases. I would suggest something along the lines of:
<!-- name: test_raises; mark: xfail(raises=IndexError) -->
```python
1 / 0
> I just don't understand how this is better than a hidden code block, you can of course make the indent parameter so that it moves the code 4 spaces to the right, for example, so that the code is not so scary, but it seems to me that it is better to write a comment to the user that an exception is being handled in this place
I'm not sure I understood you correctly. Could you maybe rephrase your last point?
I don't think that the hidden code block is worse, I just think the sudden identation will throw users off.
I could not hide the `with pytest.raises`, but I don't want to randomly mention `pytest` in the middle of the documentation whenever I want to show user's that an exception will be thrown.
I think it would be nice to test for raised exceptions.
This is already possible like this:
-->