<commit_before>import pytest
import json
import os.path
from click.testing import CliRunner

from elm_doc import cli
from elm_doc import catalog_tasks


@pytest.fixture
def runner():
    return CliRunner()


def test_cli_missing_arg(tmpdir, runner):
    with tmpdir.as_cwd():
        result = runner.invoke(cli.main)
        assert result.exception
        assert result.exit_code == 2


def test_cli_invalid_mount_at(tmpdir, runner):
    with tmpdir.as_cwd():
        result = runner.invoke(cli.main, ['--output', 'docs', '.', '--mount-at', 'elm'])
        assert result.exception
        assert result.exit_code == 2
        assert 'mount-at' in result.output


def test_cli_non_existent_elm_path(tmpdir, runner):
    with tmpdir.as_cwd():
        result = runner.invoke(cli.main, ['--output', 'docs', '.', '--elm-path', 'elm-path'])
        assert result.exception
        assert result.exit_code == 2, result.output
        assert 'elm-path' in result.output


def test_cli_in_empty_project(tmpdir, runner):
    with tmpdir.as_cwd():
        result = runner.invoke(cli.main, ['--output', 'docs', '.', '--fake-license', 'BSD-3-Clause'])
        assert result.exception
        assert result.exit_code != 0
<commit_msg>Explicitly assert what error should be raised<commit_after>import os.path
import json

import pytest
from click.testing import CliRunner

from elm_doc import cli
from elm_doc import catalog_tasks


@pytest.fixture
def runner():
    return CliRunner()


def test_cli_missing_arg(tmpdir, runner):
    with tmpdir.as_cwd():
        result = runner.invoke(cli.main)
        assert result.exception
        assert result.exit_code == 2


def test_cli_invalid_mount_at(tmpdir, runner):
    with tmpdir.as_cwd():
        result = runner.invoke(cli.main, ['--output', 'docs', '.', '--mount-at', 'elm'])
        assert result.exception
        assert result.exit_code == 2
        assert 'mount-at' in result.output


def test_cli_non_existent_elm_path(tmpdir, runner):
    with tmpdir.as_cwd():
        result = runner.invoke(cli.main, ['--output', 'docs', '.', '--elm-path', 'elm-path'])
        assert result.exception
        assert result.exit_code == 2, result.output
        assert 'elm-path' in result.output


def test_cli_in_empty_project(tmpdir, runner):
    with tmpdir.as_cwd():
        result = runner.invoke(cli.main, ['--output', 'docs', '.', '--fake-license', 'BSD-3-Clause'])
        assert result.exception
        assert result.exit_code != 0
        assert 'does not look like an Elm project' in str(result.exception)

{'fraction_non_alphanumeric': 0.12896903175225402, 'fraction_numerical': 0.003920031360250882, 'mean_word_length': 3.13614262560778, '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': '2530788', 'n_tokens_mistral': 820, 'n_tokens_neox': 799, 'n_words': 200}