コード例 #1
0
ファイル: test_string.py プロジェクト: cclauss/crosscompute
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
コード例 #2
0
ファイル: test_string.py プロジェクト: poguez/crosscompute
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
コード例 #3
0
ファイル: test_string.py プロジェクト: poguez/crosscompute
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
コード例 #4
0
ファイル: test_string.py プロジェクト: cclauss/crosscompute
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
コード例 #5
0
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'
コード例 #6
0
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'
コード例 #7
0
def test_bad_output(tmpdir):
    args = str(tmpdir), 'save-bad-integer'
    r = run(*args)
    assert 'bad_integer.error' in r['type_errors']
コード例 #8
0
ファイル: test_unicode.py プロジェクト: salah93/crosscompute
def test_file_name_with_unicode(tmpdir):
    args = str(tmpdir), 'file-name-with-unicode',
    r = run(*args)
    assert r['standard_output'] == 'acta non verba'
コード例 #9
0
ファイル: test_string.py プロジェクト: poguez/crosscompute
def test_target_folder(tmpdir):
    args = str(tmpdir), 'target-folder'
    r = run(*args)
    assert r['standard_output'].startswith(tempfile.gettempdir())
コード例 #10
0
def test_good_input(tmpdir):
    args = str(tmpdir), 'load-integer', {'x_integer': 2}
    r = run(*args)
    r['standard_outputs']['y_integer'] == 4
コード例 #11
0
ファイル: test_string.py プロジェクト: cclauss/crosscompute
def test_file_name_with_spaces(tmpdir):
    args = str(tmpdir), 'file-name-with-spaces',
    r = run(*args)
    assert r['standard_output'] == 'actions not words'
コード例 #12
0
ファイル: test_string.py プロジェクト: poguez/crosscompute
def test_file_name_with_spaces(tmpdir):
    args = str(tmpdir), 'file-name-with-spaces',
    r = run(*args)
    assert r['standard_output'] == 'actions not words'
コード例 #13
0
def test_bad_output(tmpdir):
    args = str(tmpdir), 'save-bad-integer'
    r = run(*args)
    assert 'bad_integer.error' in r['type_errors']
コード例 #14
0
ファイル: test_string.py プロジェクト: cclauss/crosscompute
def test_target_folder(tmpdir):
    args = str(tmpdir), 'target-folder'
    r = run(*args)
    assert r['standard_output'].startswith(str(tmpdir))
コード例 #15
0
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'
コード例 #16
0
def test_good_input(tmpdir):
    args = str(tmpdir), 'load-integer', {'x_integer': 2}
    r = run(*args)
    r['raw_outputs']['y_integer'] == 4
コード例 #17
0
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
コード例 #18
0
def test_find_primes(tmpdir):
    args = str(tmpdir), 'find-primes', {'x_integer': 2016}
    r = run(*args)
    assert r['standard_outputs']['unique_factor_count'] == 3
コード例 #19
0
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
コード例 #20
0
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'
コード例 #21
0
def test_find_primes(tmpdir):
    args = str(tmpdir), 'find-primes', {'x_integer': 2016}
    r = run(*args)
    assert r['standard_outputs']['unique_factor_count'] == 3