<commit_before>"""
Tests for `ish`.
"""

import subprocess
from helpers import run


def ish(cmd):
    p1 = subprocess.Popen(["echo", cmd], stdout=subprocess.PIPE)
    p2 = subprocess.Popen(["./bin/ish", "-q"], stdin=p1.stdout,
                          stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    p1.stdout.close()
    output = p2.communicate()
    if output[0]:
        stdout = output[0].decode()
    else:
        stdout = ''

    if output[1]:
        stderr = output[1].decode()
    else:
        stderr = ''

    return {'stdout': stdout, 'stderr': stderr, 'process': p2}


def test_version():
    """Check that -v works."""
    assert run(["ish", "-v"]).stdout.startswith("ish v")


def test_missing_args():
    """Nothing to test: `ish` accepts any number of arguments."""
    pass


def test_extra_args():
    """Nothing to test: `ish` accepts any number of arguments."""
    pass

<commit_msg>[tests/ish] Add returncode to ish(...)<commit_after>"""
Tests for `ish`.
"""

import subprocess
from helpers import run


def ish(cmd):
    p1 = subprocess.Popen(["echo", cmd], stdout=subprocess.PIPE)
    p2 = subprocess.Popen(["./bin/ish", "-q"], stdin=p1.stdout,
                          stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    p1.stdout.close()
    output = p2.communicate()
    if output[0]:
        stdout = output[0].decode()
    else:
        stdout = ''

    if output[1]:
        stderr = output[1].decode()
    else:
        stderr = ''

    return {'stdout': stdout,
            'stderr': stderr,
            'process': p2,
            'returncode': p2.returncode}


def test_version():
    """Check that -v works."""
    assert run(["ish", "-v"]).stdout.startswith("ish v")


def test_missing_args():
    """Nothing to test: `ish` accepts any number of arguments."""
    pass


def test_extra_args():
    """Nothing to test: `ish` accepts any number of arguments."""
    pass


{'fraction_non_alphanumeric': 0.164576802507837, 'fraction_numerical': 0.0109717868338558, 'mean_word_length': 2.6132075471698113, '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': '2832877', 'n_tokens_mistral': 643, 'n_tokens_neox': 619, 'n_words': 162}