# Test helpers


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

<table style="width:7%;">
<colgroup>
<col style="width: 6%" />
</colgroup>
<tbody>
<tr>
<td><!-- # Prologue --></td>
</tr>
</tbody>
</table>

# test_raises

Context manager for testing exceptions. More ergonomic than `test_fail`
for multi-line code blocks and allows optional message content
validation.

------------------------------------------------------------------------

<a href="https://github.com/civvic/pote/blob/main/pote/test.py#L19"
target="_blank" style="float:right; font-size:smaller">source</a>

### test_raises

``` python

def test_raises(
    expected:Type[Exception], contains:str | None=None
):

```

``` python
with test_raises(ZeroDivisionError):
    1/0  # type: ignore

with test_raises(ZeroDivisionError, 'division by zero'):
    1/0  # type: ignore
```

# test_afail

Async version of
[`fastcore.test.test_fail`](https://fastcore.fast.ai/test.html#test_fail).
Test that an async function raises an exception.

------------------------------------------------------------------------

<a href="https://github.com/civvic/pote/blob/main/pote/test.py#L32"
target="_blank" style="float:right; font-size:smaller">source</a>

### test_afail

``` python

async def test_afail(
    f, msg:str='', contains:str='', args:NoneType=None, kwargs:NoneType=None
):

```

Like fastcore own ‘test_fail’, but async

# test_is_not

Test that two objects are not the same instance. Complement to
[`fastcore.test.test_is`](https://fastcore.fast.ai/test.html#test_is).

------------------------------------------------------------------------

<a href="https://github.com/civvic/pote/blob/main/pote/test.py#L43"
target="_blank" style="float:right; font-size:smaller">source</a>

### test_is_not

``` python

def test_is_not(
    a, b
):

```

*`test` that `a is not b`*

## <!-- # Colophon -->
