<commit_before>"""
Tests for testing responder implementations.
"""
from twisted.trial.unittest import FailTest

class ResponderTestMixin(object):
    """
    A test mixin for testing CommandLocator subclasses.
    """
    command = None
    """The command.

    """

    locator = None
    """The responder locator instance.

    """

    responder = None
    """The expected responder method.

    """

    def test_locateResponder(self):
        """There is a responder for this command.

        """
        if self.command is None:
            raise FailTest("The command must be specified.")
        if self.locator is None:
            raise FailTest("The locator must be specified.")

        responder = self.locator.locateResponder(self.command.__name__)
        if responder is None:
            template = "The locator did not have a {0} responder."
            raise FailTest(template.format(self.command))

        self.assertIdentical(responder.im_func, self.responder.im_func)
<commit_msg>Fix respondertext<commit_after>"""
Tests for testing responder implementations.
"""
from twisted.trial.unittest import FailTest

class ResponderTestMixin(object):
    """
    A test mixin for testing CommandLocator subclasses.
    """
    command = None
    """The command.

    """

    locator = None
    """The responder locator instance.

    """

    responder = None
    """The expected responder method.

    """

    def test_locateResponder(self):
        """There is a responder for this command.

        """
        if self.command is None:
            raise FailTest("The command must be specified.")
        if self.locator is None:
            raise FailTest("The locator must be specified.")

        responder = self.locator.locateResponder(self.command.__name__)
        if responder is None:
            template = "The locator did not have a {0} responder."
            raise FailTest(template.format(self.command))

        # this is where it gets gross
        responderFunction = responder.func_closure[0].cell_contents.im_func
        self.assertIdentical(responderFunction, self.responder.im_func)

{'fraction_non_alphanumeric': 0.09398496240601503, 'fraction_numerical': 0.0014097744360902255, 'mean_word_length': 2.560200668896321, 'pattern_counts': {'":': 0, '<': 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': '4121321', 'n_tokens_mistral': 598, 'n_tokens_neox': 577, 'n_words': 175}