<commit_before># -*- coding: utf-8 -*-

from scout.commands import app_cli
from scout.server.extensions import store

def test_view_diseases(mock_app):
    """Test CLI that shows all HPO terms in the database"""

    runner = mock_app.test_cli_runner()
    assert runner

    # Test CLI base, no arguments provided
    result =  runner.invoke(app_cli, ['view', 'hpo'])
    assert result.exit_code == 0
    # no term shold be returned
    assert "No matching terms found" in result.output

    # no HPO terms in database, so insert one
    assert store.hpo_term_collection.find().count() == 0
    hpo_term = {
        '_id' : 'HP:0000311',
        'hpo_id' : 'HP:0000311',
        'hpo_number' : 311,
        'description' : 'Round face',
        'genes' : [4392, 30832],
    }
    store.hpo_term_collection.insert(hpo_term)

    # Test CLI providing a term
    result =  runner.invoke(app_cli, ['view', 'hpo',
        '-t', 'HP:0000311'
        ])
    assert result.exit_code == 0
    # Term should be found
    assert "Found 1 terms with search word HP:0000311" in result.output

    # Test CLI by providing HPO term not starting with 'HP00..'
    result =  runner.invoke(app_cli, ['view', 'hpo',
        '-t', '311'
        ])
    assert result.exit_code == 0
    # Term should be found
    assert "Found 1 terms with search word HP:0000311" in result.output

    # Test CLI by providing HPO term description
    result =  runner.invoke(app_cli, ['view', 'hpo',
        '-d', 'face'
        ])
    assert result.exit_code == 0
    # Term should be found
    assert "Found 1 terms with search word face" in result.output<commit_msg>fixed all conflicts<commit_after># -*- coding: utf-8 -*-

from scout.commands import app_cli
from scout.server.extensions import store

def test_view_hpo(mock_app):
    """Test CLI that shows all HPO terms in the database"""

    runner = mock_app.test_cli_runner()
    assert runner

    # Test CLI base, no arguments provided
    result =  runner.invoke(app_cli, ['view', 'hpo'])
    assert result.exit_code == 0
    # no term shold be returned
    assert "No matching terms found" in result.output

    # no HPO terms in database, so insert one
    assert store.hpo_term_collection.find().count() == 0
    hpo_term = {
        '_id' : 'HP:0000311',
        'hpo_id' : 'HP:0000311',
        'hpo_number' : 311,
        'description' : 'Round face',
        'genes' : [4392, 30832],
    }
    store.hpo_term_collection.insert(hpo_term)

    # Test CLI providing a term
    result =  runner.invoke(app_cli, ['view', 'hpo',
        '-t', 'HP:0000311'
        ])
    assert result.exit_code == 0
    # Term should be found
    assert "Found 1 terms" in result.output

    # Test CLI by providing HPO term not starting with 'HP00..'
    result =  runner.invoke(app_cli, ['view', 'hpo',
        '-t', '311'
        ])
    assert result.exit_code == 0
    # Term should be found
    assert "Found 1 terms" in result.output

    # Test CLI by providing HPO term description
    result =  runner.invoke(app_cli, ['view', 'hpo',
        '-d', 'face'
        ])
    assert result.exit_code == 0
    # Term should be found
    assert "Found 1 terms" in result.output
{'fraction_non_alphanumeric': 0.11602383192223267, 'fraction_numerical': 0.03386641580432737, 'mean_word_length': 2.645714285714286, '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': '5887670', 'n_tokens_mistral': 1100, 'n_tokens_neox': 993, 'n_words': 325}