Beispiel #1
0
def test_stream_parsing(tmpdir, text=TEXT):
    args = str(tmpdir), 'assign', {'x': text}
    r = run(*args)
    assert r['standard_outputs']['a'] == text
    assert r['standard_errors']['a'] == text
    s = serve(*args)[0]
    assert extract_text(s, 'a-result') == text
    assert extract_text(s, 'a-feedback') == text
Beispiel #2
0
def test_stream_logging(tmpdir, text=TEXT):
    args = str(tmpdir), 'echo', {'x': text}
    r = run(*args)
    assert r['standard_output'] == text
    assert r['standard_error'] == text
    s = serve(*args)[0]
    assert extract_text(s, 'standard_output-meta') == text
    assert extract_text(s, 'standard_error-meta') == text
Beispiel #3
0
def test_stream_parsing(tmpdir, text=TEXT):
    args = str(tmpdir), 'assign', {'x': text}
    r = run(*args)
    assert r['standard_outputs']['a'] == text
    assert r['standard_errors']['a'] == text
    s = serve(*args)[0]
    assert extract_text(s, 'a-result') == text
    assert extract_text(s, 'a-error') == text
Beispiel #4
0
def test_stream_logging(tmpdir, text=TEXT):
    args = str(tmpdir), 'echo', {'x': text}
    r = run(*args)
    assert r['standard_output'] == text
    assert r['standard_error'] == text
    s = serve(*args)[0]
    assert extract_text(s, 'standard_output-meta') == text
    assert extract_text(s, 'standard_error-meta') == text
def test_count_words(tmpdir):
    args = str(tmpdir), 'count-words', {'document_text_path': 'words.txt'}
    r = run(*args)
    assert r['standard_outputs']['word_count'] == 113
    t = read_csv(r['standard_outputs']['word_count_table_path'])
    assert t['count'].sum() == 113
    args = str(tmpdir), 'count-words', {
        'document_text_txt': 'curae canitiem inducunt'}
    s = serve(*args)[0]
    s.find(id='word_count-result').text.strip() == '3'
def test_count_words(tmpdir):
    args = str(tmpdir), 'count-words', {'document_text_path': 'words.txt'}
    r = run(*args)
    assert r['standard_outputs']['word_count'] == 113
    t = read_csv(r['standard_outputs']['word_count_table_path'])
    assert t['count'].sum() == 113
    args = str(tmpdir), 'count-words', {
        'document_text-txt': 'curae canitiem inducunt'
    }
    s = serve(*args)[0]
    s.find(id='word_count-result').text.strip() == '3'
def test_bad_output(tmpdir):
    args = str(tmpdir), 'save-bad-integer'
    r = run(*args)
    assert 'bad_integer.error' in r['type_errors']
Beispiel #8
0
def test_file_name_with_unicode(tmpdir):
    args = str(tmpdir), 'file-name-with-unicode',
    r = run(*args)
    assert r['standard_output'] == 'acta non verba'
Beispiel #9
0
def test_target_folder(tmpdir):
    args = str(tmpdir), 'target-folder'
    r = run(*args)
    assert r['standard_output'].startswith(tempfile.gettempdir())
def test_good_input(tmpdir):
    args = str(tmpdir), 'load-integer', {'x_integer': 2}
    r = run(*args)
    r['standard_outputs']['y_integer'] == 4
Beispiel #11
0
def test_file_name_with_spaces(tmpdir):
    args = str(tmpdir), 'file-name-with-spaces',
    r = run(*args)
    assert r['standard_output'] == 'actions not words'
Beispiel #12
0
def test_file_name_with_spaces(tmpdir):
    args = str(tmpdir), 'file-name-with-spaces',
    r = run(*args)
    assert r['standard_output'] == 'actions not words'
def test_bad_output(tmpdir):
    args = str(tmpdir), 'save-bad-integer'
    r = run(*args)
    assert 'bad_integer.error' in r['type_errors']
Beispiel #14
0
def test_target_folder(tmpdir):
    args = str(tmpdir), 'target-folder'
    r = run(*args)
    assert r['standard_output'].startswith(str(tmpdir))
def test_add_integers(tmpdir):
    args = str(tmpdir), 'add-integers', {'x_integer': 2, 'y_integer': 3}
    r = run(*args)
    assert r['standard_output'] == '5'
    s = serve(*args)[0]
    assert s.find(id='standard_output-meta').text.strip() == '5'
def test_good_input(tmpdir):
    args = str(tmpdir), 'load-integer', {'x_integer': 2}
    r = run(*args)
    r['raw_outputs']['y_integer'] == 4
def test_good_input(tmpdir):
    args = str(tmpdir), 'load-table', {'a_table_path': 'good.csv'}
    r = run(*args)
    assert r['raw_outputs']['row_count'] == 3
def test_find_primes(tmpdir):
    args = str(tmpdir), 'find-primes', {'x_integer': 2016}
    r = run(*args)
    assert r['standard_outputs']['unique_factor_count'] == 3
def test_good_input(tmpdir):
    args = str(tmpdir), 'load-table', {'a_table_path': 'good.csv'}
    r = run(*args)
    assert r['standard_outputs']['row_count'] == 3
def test_add_integers(tmpdir):
    args = str(tmpdir), 'add-integers', {'x_integer': 2, 'y_integer': 3}
    r = run(*args)
    assert r['standard_output'] == '5'
    s = serve(*args)[0]
    assert s.find(id='standard_output-meta').text.strip() == '5'
def test_find_primes(tmpdir):
    args = str(tmpdir), 'find-primes', {'x_integer': 2016}
    r = run(*args)
    assert r['standard_outputs']['unique_factor_count'] == 3