コード例 #1
0
ファイル: test_report.py プロジェクト: ClusterLabs/crmsh
def test_head():
    temp_file = create_tempfile()
    with open(temp_file, 'w') as f:
        f.write(sample_string1)
    _, out = get_command_info("cat %s|head -3" % temp_file)
    with open(temp_file, 'r') as f:
        data = f.read()
    res = head(3, data)

    os.remove(temp_file)
    eq_(out.rstrip('\n'), '\n'.join(res))
コード例 #2
0
def test_head():
    temp_file = create_tempfile()
    with open(temp_file, 'w') as f:
        f.write(sample_string1)
    _, out = get_command_info("cat %s|head -3" % temp_file)
    with open(temp_file, 'r') as f:
        data = f.read()
    res = head(3, data)

    os.remove(temp_file)
    assert out.rstrip('\n') == '\n'.join(res)
コード例 #3
0
def test_head():
    in_string = """some aaa
some bbbb
some cccc
some dddd
"""
    temp_file = create_tempfile()
    with open(temp_file, 'w') as f:
        f.write(in_string)
    _, out = get_command_info("cat %s|head -3" % temp_file)
    with open(temp_file, 'r') as f:
        data = f.read()
    res = head(3, data)

    os.remove(temp_file)
    eq_(out, '\n'.join(res))