<commit_before>import random
import shlex
import sys

class Plugin:
    def on_command(self, bot, msg):
        args = sys.argv[1:]
        if not args:
            args = shlex.split(sys.stdin.read().strip())
        print(random.choice(args))

    def on_help(self):
        return "Usage: decide <a> <b> …"<commit_msg>Add tests for decide plugin<commit_after>import io
import random
import shlex
import unittest


class Plugin:
    def on_command(self, bot, msg, stdin, stdout, reply):
        args = msg["args"][1:]
        if not args:
            args = shlex.split(stdin.read().strip())
        if args:
            print(random.choice(args), file=stdout)
        else:
            print(self.on_help(), file=stdout)

    def on_help(self):
        return "Usage: decide <a> <b> …"


class Test(unittest.TestCase):
    def setUp(self):
        self.plugin = Plugin()

    def test_decisions(self):
        decisions = []
        for i in range(1, 10):
            decisions.append("decision {0}".format(i))
            stdout = io.StringIO()
            self.plugin.on_command(None, {"args": [None] + decisions}, None, stdout, None)
            self.assertTrue(stdout.getvalue().strip() in decisions)

    def test_help(self):
        self.assertTrue(self.plugin.on_help())

    def test_no_args(self):
        stdout = io.StringIO()
        self.plugin.on_command(None, {"args": [None]}, stdout, stdout, None)
        self.assertEqual(self.plugin.on_help(), stdout.getvalue().strip())
{'fraction_non_alphanumeric': 0.1380697050938338, 'fraction_numerical': 0.004021447721179625, 'mean_word_length': 2.5463182897862233, 'pattern_counts': {'":': 2, '<': 7, '<?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': '2710399', 'n_tokens_mistral': 478, 'n_tokens_neox': 464, 'n_words': 113}