def test_tail(): temp_file = create_tempfile() with open(temp_file, 'w') as f: f.write(sample_string1) _, out = get_command_info("cat %s|tail -3" % temp_file) with open(temp_file, 'r') as f: data = f.read() res = tail(3, data) os.remove(temp_file) eq_(out.rstrip('\n'), '\n'.join(res))
def test_tail(): temp_file = create_tempfile() with open(temp_file, 'w') as f: f.write(sample_string1) _, out = get_command_info("cat %s|tail -3" % temp_file) with open(temp_file, 'r') as f: data = f.read() res = tail(3, data) os.remove(temp_file) assert out.rstrip('\n') == '\n'.join(res)
def test_tail(): 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|tail -3" % temp_file) with open(temp_file, 'r') as f: data = f.read() res = tail(3, data) os.remove(temp_file) eq_(out, '\n'.join(res))