<commit_before># coding: utf-8
"""
:class:`asynctest.TestCase` decorator which controls checks performed after
tests.

This module is separated from :mod:`asynctest.case` to avoid circular imports
in modules registering new checks.
"""
from asyncio import TimerHandle


_FAIL_ON_ATTR = "_asynctest_fail_on"


DEFAULTS = {
    "unused_loop": True,
    "active_handles": False,
}


class _fail_on:<commit_msg>Document the implementation of new checks<commit_after># coding: utf-8
"""
:class:`asynctest.TestCase` decorator which controls checks performed after
tests.

This module is separated from :mod:`asynctest.case` to avoid circular imports
in modules registering new checks.

To implement new checks:

    * its name must be added in the ``DEFAULTS`` dict,

    * a static method of the same name must be added to the :class:`_fail_on`
      class,

    * an optional static method named ``before_[name of the check]`` can be
      added to :class:`_fail_on` to implement some set-up before the test runs.

A check may be only available on some platforms, activated by a conditional
import. In this case, ``DEFAULT`` and :class:`_fail_on` can be updated in the
module. There is an example in the :mod:`asynctest.selector` module.
"""
from asyncio import TimerHandle


_FAIL_ON_ATTR = "_asynctest_fail_on"


#: Default value of the arguments of @fail_on, the name of the argument matches
#: the name of the static method performing the check in the :class:`_fail_on`.
#: The value is True when the check is enabled by default, False otherwise.
DEFAULTS = {
    "unused_loop": True,
    "active_handles": False,
}


class _fail_on:
{'fraction_non_alphanumeric': 0.0838946723821188, 'fraction_numerical': 0.001224739742804654, 'mean_word_length': 4.483221476510067, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5963765', 'n_tokens_mistral': 489, 'n_tokens_neox': 476, 'n_words': 203}