@@ -179,7 +179,7 @@ class RaisesExc(AbstractRaises[BaseExcT_co_default]):
179
179
"""
180
180
.. versionadded:: 8.4
181
181
182
- Helper class to be used together with RaisesGroups when you want to specify requirements on sub-exceptions.
182
+ Helper class to be used together with RaisesGroup when you want to specify requirements on sub-exceptions.
183
183
184
184
You don't need this if you only want to specify the type, since :class:`RaisesGroup`
185
185
accepts ``type[BaseException]``.
@@ -191,11 +191,11 @@ class RaisesExc(AbstractRaises[BaseExcT_co_default]):
191
191
192
192
Examples::
193
193
194
- with RaisesGroups (RaisesExc(ValueError, match="string"))
194
+ with RaisesGroup (RaisesExc(ValueError, match="string"))
195
195
...
196
- with RaisesGroups (RaisesExc(check=lambda x: x.args == (3, "hello"))):
196
+ with RaisesGroup (RaisesExc(check=lambda x: x.args == (3, "hello"))):
197
197
...
198
- with RaisesGroups (RaisesExc(check=lambda x: type(x) is ValueError)):
198
+ with RaisesGroup (RaisesExc(check=lambda x: type(x) is ValueError)):
199
199
...
200
200
"""
201
201
@@ -323,33 +323,33 @@ class RaisesGroup(AbstractRaises[BaseExceptionGroup[BaseExcT_co]]):
323
323
extracting all exceptions inside any nested :exc:`ExceptionGroup`, before matching.
324
324
325
325
It does not care about the order of the exceptions, so
326
- ``RaisesGroups (ValueError, TypeError)``
326
+ ``RaisesGroup (ValueError, TypeError)``
327
327
is equivalent to
328
- ``RaisesGroups (TypeError, ValueError)``.
328
+ ``RaisesGroup (TypeError, ValueError)``.
329
329
330
330
Examples::
331
331
332
- with RaisesGroups (ValueError):
332
+ with RaisesGroup (ValueError):
333
333
raise ExceptionGroup("", (ValueError(),))
334
- with RaisesGroups (
334
+ with RaisesGroup (
335
335
ValueError, ValueError, RaisesExc(TypeError, match="expected int")
336
336
):
337
337
...
338
- with RaisesGroups (
338
+ with RaisesGroup (
339
339
KeyboardInterrupt,
340
340
match="hello",
341
341
check=lambda x: type(x) is BaseExceptionGroup,
342
342
):
343
343
...
344
- with RaisesGroups(RaisesGroups (ValueError)):
344
+ with RaisesGroup(RaisesGroup (ValueError)):
345
345
raise ExceptionGroup("", (ExceptionGroup("", (ValueError(),)),))
346
346
347
347
# flatten_subgroups
348
- with RaisesGroups (ValueError, flatten_subgroups=True):
348
+ with RaisesGroup (ValueError, flatten_subgroups=True):
349
349
raise ExceptionGroup("", (ExceptionGroup("", (ValueError(),)),))
350
350
351
351
# allow_unwrapped
352
- with RaisesGroups (ValueError, allow_unwrapped=True):
352
+ with RaisesGroup (ValueError, allow_unwrapped=True):
353
353
raise ValueError
354
354
355
355
@@ -358,7 +358,7 @@ class RaisesGroup(AbstractRaises[BaseExceptionGroup[BaseExcT_co]]):
358
358
359
359
The matching algorithm is greedy, which means cases such as this may fail::
360
360
361
- with RaisesGroups (ValueError, RaisesExc(ValueError, match="hello")):
361
+ with RaisesGroup (ValueError, RaisesExc(ValueError, match="hello")):
362
362
raise ExceptionGroup("", (ValueError("hello"), ValueError("goodbye")))
363
363
364
364
even though it generally does not care about the order of the exceptions in the group.
@@ -620,7 +620,7 @@ def matches(
620
620
621
621
with pytest.raises(TypeError) as excinfo:
622
622
...
623
- assert RaisesGroups (ValueError).matches(excinfo.value.__cause__)
623
+ assert RaisesGroup (ValueError).matches(excinfo.value.__cause__)
624
624
# the above line is equivalent to
625
625
myexc = excinfo.value.__cause
626
626
assert isinstance(myexc, BaseExceptionGroup)
0 commit comments