<!-- HILSTER htf 4.3.1 -->
**htf 4.3.1** · [HTML](../assertions.html) · [Complete PDF manual](../_downloads/htf-4.3.1.pdf)

<a id="assertions"></a>

# Assertions

Assertions are used to assert conditions of your tests. With assertions the actual
testing is realized.

## Assert Statement

The easiest way to assert a statement is to use the `assert` statement.

```python
def test_with_assert():
    assert True, "This is the assertions failure message"
```

## Built-in Assertions

To write tests with finegrained assertions you can use the
built-in assertions.

All specialized assertions can be used via the module [`htf.assertions`](#module-htf.assertions) or
the `assertions` fixture.

```python
def test_with_assertions_fixture(assertions):
    assertions.assert_true(True, "This is the assertions failure message")
    assertions.assert_almost_equal(1.00, 1.01, places=2)
    # etc.


def test_with_assertions_module():
    htf.assertions.assert_true(True, "This is the assertions failure message")
    htf.assertions.assert_almost_equal(1.00, 1.01, places=2)
```

<a id="module-htf.assertions"></a>

### htf.assertions.assert_almost_equal(a: [float](https://docs.python.org/3/builtins/functions.html#float), b: [float](https://docs.python.org/3/builtins/functions.html#float), places: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, delta: [float](https://docs.python.org/3/builtins/functions.html#float) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` and `b` are almost equal. Useful to compare floating point numbers.
Comparison is realized either using a maximum `delta` or the number of decimal `places`

* **Parameters:**
  * **a** – number
  * **b** – number
  * **places=None** – the number of decimal places for comparison. If `None` `7` decimal places are used.
  * **delta=None** – the maximum delta
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are not almost equal

### htf.assertions.assert_dict_equal(a: [Dict](https://docs.python.org/3/library/typing.html#typing.Dict), b: [Dict](https://docs.python.org/3/library/typing.html#typing.Dict), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` equals `b` and that both are of type `dict`.

* **Parameters:**
  * **a** – a dict
  * **b** – a dict
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are not equal

### htf.assertions.assert_equal(a: [Any](https://docs.python.org/3/library/typing.html#typing.Any), b: [Any](https://docs.python.org/3/library/typing.html#typing.Any), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` equals `b`. Tries to find a registered equality asserter and uses the base assert if
no special assert is registered.

* **Parameters:**
  * **a** – an object
  * **b** – an object
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are not equal

### htf.assertions.assert_false(expression: [bool](https://docs.python.org/3/builtins/functions.html#bool), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `expression` is `False`.

* **Parameters:**
  * **expression** – the boolean expression to be validated
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `expression` is not `False`

### htf.assertions.assert_greater(a: [Any](https://docs.python.org/3/library/typing.html#typing.Any), b: [Any](https://docs.python.org/3/library/typing.html#typing.Any), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` is greater than `b`.

* **Parameters:**
  * **a** – a comparable object
  * **b** – a comparable object
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` is not greater than `b`

### htf.assertions.assert_greater_equal(a: [Any](https://docs.python.org/3/library/typing.html#typing.Any), b: [Any](https://docs.python.org/3/library/typing.html#typing.Any), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` is greater or equal to `b`.

* **Parameters:**
  * **a** – a comparable object
  * **b** – a comparable object
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` is not greater or equal to `b`

### htf.assertions.assert_in(member: [Any](https://docs.python.org/3/library/typing.html#typing.Any), container: [Iterable](https://docs.python.org/3/library/typing.html#typing.Iterable), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `container` contains `member`.

* **Parameters:**
  * **member** – the object that shall be included in `container`
  * **container** – an iterable to search for `member`
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `member` is not included in `container`

### htf.assertions.assert_is(a: [Any](https://docs.python.org/3/library/typing.html#typing.Any), b: [Any](https://docs.python.org/3/library/typing.html#typing.Any), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `id(a)` equals `id(b)`.

* **Parameters:**
  * **a** – an object
  * **b** – another object
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `id(a)` does not equal `id(b)`

### htf.assertions.assert_is_instance(obj: [Any](https://docs.python.org/3/library/typing.html#typing.Any), cls: [Type](https://docs.python.org/3/library/typing.html#typing.Type), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `obj` is an instance of `cls`.

* **Parameters:**
  * **obj** – an instance
  * **cls** – a class `obj` shall be an instance of
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `obj` is not an instance of `cls`

### htf.assertions.assert_is_none(obj: [Any](https://docs.python.org/3/library/typing.html#typing.Any), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `obj` is `None`.

* **Parameters:**
  * **obj** – an object
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `obj` is not `None`

### htf.assertions.assert_is_not(a: [Any](https://docs.python.org/3/library/typing.html#typing.Any), b: [Any](https://docs.python.org/3/library/typing.html#typing.Any), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `id(a)` does not equal `id(b)`.

* **Parameters:**
  * **a** – an object
  * **b** – another object
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `id(a)` equals `id(b)`

### htf.assertions.assert_is_not_instance(obj: [Any](https://docs.python.org/3/library/typing.html#typing.Any), cls: [Type](https://docs.python.org/3/library/typing.html#typing.Type), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `obj` is not an instance of `cls`.

* **Parameters:**
  * **obj** – an instance
  * **cls** – a class `obj` shall not be an instance of
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `obj` is an instance of `cls`

### htf.assertions.assert_is_not_none(obj: [Any](https://docs.python.org/3/library/typing.html#typing.Any), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `obj` is not `None`.

* **Parameters:**
  * **obj** – an object
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `obj` is  `None`

### htf.assertions.assert_less(a: [Any](https://docs.python.org/3/library/typing.html#typing.Any), b: [Any](https://docs.python.org/3/library/typing.html#typing.Any), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` is less than `b`.

* **Parameters:**
  * **a** – a comparable object
  * **b** – a comparable object
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` is not less than `b`

### htf.assertions.assert_less_equal(a: [Any](https://docs.python.org/3/library/typing.html#typing.Any), b: [Any](https://docs.python.org/3/library/typing.html#typing.Any), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` is less or equal to `b`.

* **Parameters:**
  * **a** – a comparable object
  * **b** – a comparable object
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` is not less or equal to `b`

### htf.assertions.assert_list_equal(a: [List](https://docs.python.org/3/library/typing.html#typing.List), b: [List](https://docs.python.org/3/library/typing.html#typing.List), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` equals `b` and that both are of type `list`.

* **Parameters:**
  * **a** – a list
  * **b** – a list
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are not equal or not lists

### htf.assertions.assert_multi_line_equal(a: [str](https://docs.python.org/3/builtins/stdtypes.html#str), b: [str](https://docs.python.org/3/builtins/stdtypes.html#str), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` equals `b` and that both are of type `str`.

* **Parameters:**
  * **a** – a string
  * **b** – a string
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are not equal or not strings

### htf.assertions.assert_not_almost_equal(a: [float](https://docs.python.org/3/builtins/functions.html#float), b: [float](https://docs.python.org/3/builtins/functions.html#float), places: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, delta: [float](https://docs.python.org/3/builtins/functions.html#float) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` and `b` are not almost equal. Useful to compare floating point numbers.
Comparison is realized either using a maximum `delta` or the number of decimal `places`

* **Parameters:**
  * **a** – number
  * **b** – number
  * **places=None** – the number of decimal places for comparison. If `None` `7` decimal places are used.
  * **delta=None** – the maximum delta
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are almost equal

### htf.assertions.assert_not_equal(a: [Any](https://docs.python.org/3/library/typing.html#typing.Any), b: [Any](https://docs.python.org/3/library/typing.html#typing.Any), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` does not equal `b`.

* **Parameters:**
  * **a** – an object
  * **b** – an object
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are equal

### htf.assertions.assert_not_in(member: [Any](https://docs.python.org/3/library/typing.html#typing.Any), container: [Iterable](https://docs.python.org/3/library/typing.html#typing.Iterable), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `container` does not contain `member`.

* **Parameters:**
  * **member** – the object that shall not be included in `container`
  * **container** – an iterable to search for `member`
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `member` is included in `container`

### htf.assertions.assert_not_is_instance(obj: [Any](https://docs.python.org/3/library/typing.html#typing.Any), cls: [Type](https://docs.python.org/3/library/typing.html#typing.Type), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `obj` is not an instance of `cls`.

* **Parameters:**
  * **obj** – an instance
  * **cls** – a class `obj` shall not be an instance of
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `obj` is an instance of `cls`

### htf.assertions.assert_not_regex(text: [str](https://docs.python.org/3/builtins/stdtypes.html#str), unexpected_regex: [str](https://docs.python.org/3/builtins/stdtypes.html#str), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `text` does not match regular expression `unexpected_regex`.

* **Parameters:**
  * **text** – a text to be matched
  * **unexpected_regex** – a regular expression to be used
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `text` matches regular expression `unexpected_regex`

### htf.assertions.assert_raises(expected_exception: [Type](https://docs.python.org/3/library/typing.html#typing.Type)[[BaseException](https://docs.python.org/3/builtins/exceptions.html#BaseException)], callable_object: [Any](https://docs.python.org/3/library/typing.html#typing.Any) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, \*args: [Any](https://docs.python.org/3/library/typing.html#typing.Any), \*\*kwargs: [Any](https://docs.python.org/3/library/typing.html#typing.Any)) → \_AssertRaisesContext | [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `expected_exception` is raised. Can be used as a context manager or
with a callable object that is run with `*args` and `**kwargs`.

* **Parameters:**
  * **expected_exception** – the expected exception that shall be raised
  * **callable_object=None** – the callable object if not used as a context manager
  * **\*args** – variable positional arguments passed to `callable_object`
  * **\*\*kwargs** – variable keyword arguments passed to `callable_object`
* **Returns:**
  a context manager if `callable_object` is `None` else `None`.
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `expected_exception` is not raised

### htf.assertions.assert_raises_regex(expected_exception: [Type](https://docs.python.org/3/library/typing.html#typing.Type)[[BaseException](https://docs.python.org/3/builtins/exceptions.html#BaseException)], expected_regex: [str](https://docs.python.org/3/builtins/stdtypes.html#str), callable_object: [Any](https://docs.python.org/3/library/typing.html#typing.Any) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, \*args: [Any](https://docs.python.org/3/library/typing.html#typing.Any), \*\*kwargs: [Any](https://docs.python.org/3/library/typing.html#typing.Any)) → \_AssertRaisesContext | [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `expected_exception` is raised. Can be used as a context manager or
with a callable object that is run with `*args` and `**kwargs`.

* **Parameters:**
  * **expected_exception** – the expected exception that shall be raised
  * **expected_regex** – the regular expression that shall match the stringified representation
    of the exception
  * **callable_object=None** – the callable object if not used as a context manager
  * **\*args** – variable positional arguments passed to `callable_object`
  * **\*\*kwargs** – variable keyword arguments passed to `callable_object`
* **Returns:**
  a context manager if `callable_object` is `None` else `None`.
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `expected_exception` is not raised or does not match `expected_regex`

### htf.assertions.assert_regex(text: [str](https://docs.python.org/3/builtins/stdtypes.html#str), expected_regex: [str](https://docs.python.org/3/builtins/stdtypes.html#str), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `text` matches regular expression `expected_regex`.

* **Parameters:**
  * **text** – a text to be matched
  * **expected_regex** – a regular expression to be used
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `text` does not match regular expression `expected_regex`

### htf.assertions.assert_sequence_equal(a: [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence), b: [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, sequence_type: [Type](https://docs.python.org/3/library/typing.html#typing.Type) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` equals `b` and that both are sequences.

* **Parameters:**
  * **a** – a sequence
  * **b** – a sequence
  * **message** – the message to prepend to the error message
  * **sequence_type=None** – the sequence type to be used (if not `None`)
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are not equal or don’t match the `sequence_type`

### htf.assertions.assert_set_equal(a: [Set](https://docs.python.org/3/library/typing.html#typing.Set), b: [Set](https://docs.python.org/3/library/typing.html#typing.Set), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` equals `b` and that both are of type `set`.

* **Parameters:**
  * **a** – a set
  * **b** – a set
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are not equal or not sets

### htf.assertions.assert_str_equal(a: [str](https://docs.python.org/3/builtins/stdtypes.html#str), b: [str](https://docs.python.org/3/builtins/stdtypes.html#str), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` equals `b` and that both are of type `str`.

* **Parameters:**
  * **a** – a string
  * **b** – a string
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are not equal or not strings

### htf.assertions.assert_true(expression: [bool](https://docs.python.org/3/builtins/functions.html#bool), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `expression` is `True`.

* **Parameters:**
  * **expression** – the boolean expression to be validated
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `expression` is not `True`

### htf.assertions.assert_tuple_equal(a: [Tuple](https://docs.python.org/3/library/typing.html#typing.Tuple), b: [Tuple](https://docs.python.org/3/library/typing.html#typing.Tuple), message: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Assert that `a` equals `b` and that both are of type `tuple`.

* **Parameters:**
  * **a** – a list
  * **b** – a list
  * **message** – the message to prepend to the error message
* **Raises:**
  [**AssertionError**](https://docs.python.org/3/builtins/exceptions.html#AssertionError) – if `a` and `b` are not equal or not tuples

### htf.assertions.get_equality_asserter(type_: [Type](https://docs.python.org/3/library/typing.html#typing.Type)) → [Callable](https://docs.python.org/3/library/typing.html#typing.Callable)[[...], [None](https://docs.python.org/3/builtins/constants.html#None)]

Return the registered equality asserter for `type_`.

* **Parameters:**
  **type** – a type
* **Returns:**
  the registered equality asserter for `type`
* **Raises:**
  [**KeyError**](https://docs.python.org/3/builtins/exceptions.html#KeyError) – if `type_` has no registered equality asserter

### htf.assertions.set_diff_threshold(threshold: [int](https://docs.python.org/3/builtins/functions.html#int)) → [None](https://docs.python.org/3/builtins/constants.html#None)

Set the diff threshold to `threshold`:

* **Parameters:**
  **threshold** – the maximum number of characters to use difflib

### htf.assertions.set_equality_asserter(type_: [Type](https://docs.python.org/3/library/typing.html#typing.Type), asserter: [Callable](https://docs.python.org/3/library/typing.html#typing.Callable)[[...], [None](https://docs.python.org/3/builtins/constants.html#None)]) → [None](https://docs.python.org/3/builtins/constants.html#None)

Register a new type equality asserter used in `assert_equal` and `assert_not_equal`.

* **Parameters:**
  * **type** – the type the checker is used for
  * **asserter** – callable equality asserter object that supports parameters `a`, `b` and `message`

### htf.assertions.set_repr_length(length: [int](https://docs.python.org/3/builtins/functions.html#int)) → [None](https://docs.python.org/3/builtins/constants.html#None)

Set the maximum representation length to `length`

* **Parameters:**
  **length** – the maximum representation length

For legacy tests the [`htf.TestCase`](writing_tests.md#htf.TestCase) offers wrappers for all built-in assertions and
also non-pep8 wrappers to support legacy tests.
