Ejemplo n.º 1
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
Ejemplo n.º 2
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
Ejemplo n.º 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-feedback') == text
Ejemplo n.º 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
Ejemplo n.º 5
0
def test_file_content(tmpdir, file_path='assets/string.txt'):
    file_content = codecs.open(join(
        TOOL_FOLDER, file_path), encoding='utf-8').read()
    args = str(tmpdir), 'file-content', {'x_path': file_path}
    s, c = serve(*args)
    assert extract_text(s, 'a-result') == file_content.strip()
    response = c.get(s.find('a', {'class': 'download'})['href'])
    zip_file = ZipFile(BytesIO(response.data))
    assert zip_file.read('a').decode('utf-8') == file_content
Ejemplo n.º 6
0
def test_file_content(tmpdir, file_path='assets/string.txt'):
    file_content = codecs.open(join(TOOL_FOLDER, file_path),
                               encoding='utf-8').read()
    args = str(tmpdir), 'file-content', {'x_txt': file_content}
    s, c = serve(*args)
    assert extract_text(s, 'a-result') == file_content.strip()
    response = c.get(s.find('a', {'class': 'download'})['href'])
    zip_file = ZipFile(BytesIO(response.data))
    assert zip_file.read('a').decode('utf-8') == file_content
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_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_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'