<commit_before>from __future__ import absolute_import, division, print_function, unicode_literals

from builtins import *
from unittest.case import TestCase

from click.testing import CliRunner

from zsl import inject
from zsl.application.containers.core_container import CoreContainer
from zsl.application.modules.cli_module import ZslCli
from zsl.router.task import TaskConfiguration
from zsl.testing.db import IN_MEMORY_DB_SETTINGS
from zsl.testing.zsl import ZslTestCase, ZslTestConfiguration


class TestCliContainer(CoreContainer):
    pass


CONFIG = IN_MEMORY_DB_SETTINGS.copy()
CONFIG.update(
    TASKS=TaskConfiguration().create_namespace('task').add_packages(['zsl.tasks']).get_configuration()
)


class ExecTaskFromCliTestCase(ZslTestCase, TestCase):
    ZSL_TEST_CONFIGURATION = ZslTestConfiguration(
        app_name="ExecTaskFromCliTestCase",
        config_object=CONFIG,
        container=TestCliContainer
    )

    @inject(zsl_cli=ZslCli)
    def testRunningTestTask(self, zsl_cli):
        # type:(ZslCli)->None
        runner = CliRunner()
        result = runner.invoke(zsl_cli.cli, ['task', 'task/zsl/test_task'])
        self.assertEqual(0, result.exit_code, "No error is expected.")
        self.assertEqual('ok', result.output.strip(), "Valid task output must be shown")

    @inject(zsl_cli=ZslCli)
    def testRunningTaskWithListInput(self, zsl_cli):
        # type:(ZslCli)->None
        runner = CliRunner()
        result = runner.invoke(zsl_cli.cli, ['task', 'task/zsl/with_request_task', '{"list_of_numbers": [1,2,3] }'])
        print(result)
        self.assertEqual(0, result.exit_code, "No error is expected.")
        self.assertEqual('[1, 2, 3]', result.output.strip(), "Valid task output must be shown")
<commit_msg>Remove unnecessry print in tests<commit_after>from __future__ import absolute_import, division, print_function, unicode_literals

from builtins import *
from unittest.case import TestCase

from click.testing import CliRunner

from zsl import inject
from zsl.application.containers.core_container import CoreContainer
from zsl.application.modules.cli_module import ZslCli
from zsl.router.task import TaskConfiguration
from zsl.testing.db import IN_MEMORY_DB_SETTINGS
from zsl.testing.zsl import ZslTestCase, ZslTestConfiguration


class TestCliContainer(CoreContainer):
    pass


CONFIG = IN_MEMORY_DB_SETTINGS.copy()
CONFIG.update(
    TASKS=TaskConfiguration().create_namespace('task').add_packages(['zsl.tasks']).get_configuration()
)


class ExecTaskFromCliTestCase(ZslTestCase, TestCase):
    ZSL_TEST_CONFIGURATION = ZslTestConfiguration(
        app_name="ExecTaskFromCliTestCase",
        config_object=CONFIG,
        container=TestCliContainer
    )

    @inject(zsl_cli=ZslCli)
    def testRunningTestTask(self, zsl_cli):
        # type:(ZslCli)->None
        runner = CliRunner()
        result = runner.invoke(zsl_cli.cli, ['task', 'task/zsl/test_task'])
        self.assertEqual(0, result.exit_code, "No error is expected.")
        self.assertEqual('ok', result.output.strip(), "Valid task output must be shown")

    @inject(zsl_cli=ZslCli)
    def testRunningTaskWithListInput(self, zsl_cli):
        # type:(ZslCli)->None
        runner = CliRunner()
        result = runner.invoke(zsl_cli.cli, ['task', 'task/zsl/with_request_task', '{"list_of_numbers": [1,2,3] }'])
        self.assertEqual(0, result.exit_code, "No error is expected.")
        self.assertEqual('[1, 2, 3]', result.output.strip(), "Valid task output must be shown")

{'fraction_non_alphanumeric': 0.10829296095753776, 'fraction_numerical': 0.004559703619264748, 'mean_word_length': 4.484375, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, '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': '1879749', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1066, 'n_words': 229}