<commit_before>import time
import unittest
import threading
import gevent.queue

import kyoto
import kyoto.dispatch
import kyoto.tests.dummy


class DispatcherTestCase(unittest.TestCase):

    def setUp(self):
        self.modules = [
            kyoto.tests.dummy,
        ]
        self.address = ("localhost", 1337)
        self.dispatcher = kyoto.dispatch.Dispatcher(self.modules, self.address)

    def test_registered_modules(self):
        self.assertIn(":dummy", self.dispatcher.modules)
        self.assertTrue(len(self.dispatcher.modules[":dummy"]) > 0)

    def test_unknown_module(self):
        response = self.dispatcher.handle(
            (":call", ":Kittens", ":echo", ["hello"]))
        self.assertEqual(next(response), (':error', (':server', 1, 'NameError', "No such module: ':Kittens'", [])))

    def test_unknown_function(self):
        response = self.dispatcher.handle(
            (":call", ":dummy", ":kittens", ["hello"]))
        self.assertEqual(next(response), (':error', (':server', 2, 'NameError', "No such function: ':kittens'", [])))

    def test_sync_call(self):
        response = self.dispatcher.handle(
            (":call", ":dummy", ":echo", ["hello"]))
        self.assertEqual(next(response), (":reply", "hello?"))

    def test_async_call(self):
        response = self.dispatcher.handle(
            (":cast", ":dummy", ":blocking_echo", ["hello"]))
        start = time.time()
        self.assertEqual(next(response), (":noreply", ))
        finish = time.time()
        self.assertTrue(finish - start < 100.0)<commit_msg>Remove test of registered modules<commit_after>import time
import unittest
import threading
import gevent.queue

import kyoto
import kyoto.dispatch
import kyoto.tests.dummy


class DispatcherTestCase(unittest.TestCase):

    def setUp(self):
        self.modules = [
            kyoto.tests.dummy,
        ]
        self.address = ("localhost", 1337)
        self.dispatcher = kyoto.dispatch.Dispatcher(self.modules, self.address)

    def test_unknown_module(self):
        response = self.dispatcher.handle(
            (":call", ":Kittens", ":echo", ["hello"]))
        self.assertEqual(next(response), (':error', (':server', 1, 'NameError', "No such module: ':Kittens'", [])))

    def test_unknown_function(self):
        response = self.dispatcher.handle(
            (":call", ":dummy", ":kittens", ["hello"]))
        self.assertEqual(next(response), (':error', (':server', 2, 'NameError', "No such function: ':kittens'", [])))

    def test_sync_call(self):
        response = self.dispatcher.handle(
            (":call", ":dummy", ":echo", ["hello"]))
        self.assertEqual(next(response), (":reply", "hello?"))

    def test_async_call(self):
        response = self.dispatcher.handle(
            (":cast", ":dummy", ":blocking_echo", ["hello"]))
        start = time.time()
        self.assertEqual(next(response), (":noreply", ))
        finish = time.time()
        self.assertTrue(finish - start < 100.0)
{'fraction_non_alphanumeric': 0.17139993317741398, 'fraction_numerical': 0.0070163715335783495, 'mean_word_length': 3.141078838174274, 'pattern_counts': {'":': 30, '<': 5, '<?xml version=': 0, '>': 4, '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': '6415052', 'n_tokens_mistral': 927, 'n_tokens_neox': 877, 'n_words': 185}