---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
B017.py:23:9: B017 `assertRaises(Exception)` should be considered evil
   |
23 |   class Foobar(unittest.TestCase):
24 |       def evil_raises(self) -> None:
25 |           with self.assertRaises(Exception):
   |  _________^
26 | |             raise Exception("Evil I say!")
   | |__________________________________________^ B017
27 |   
28 |       def context_manager_raises(self) -> None:
   |

B017.py:41:5: B017 `pytest.raises(Exception)` should be considered evil
   |
41 |   def test_pytest_raises():
42 |       with pytest.raises(Exception):
   |  _____^
43 | |         raise ValueError("Hello")
   | |_________________________________^ B017
44 |   
45 |       with pytest.raises(Exception, "hello"):
   |


