def test_two_blank_lines(self, fp_with_two_blank_lines): paragraph = read_until_blank_line(fp_with_two_blank_lines) assert paragraph == '1st\n2nd\n3rd\n' second_paragraph = read_until_blank_line(fp_with_two_blank_lines) assert second_paragraph == '4th\n5th\n' rest = read_until_blank_line(fp_with_two_blank_lines) assert rest == '6th\n7th\n'
def test_one_blank_line(self, fp_with_one_blank_line): paragraph = read_until_blank_line(fp_with_one_blank_line) assert paragraph == '1st\n2nd\n3rd\n' rest = fp_with_one_blank_line.read() assert rest == '4th\n5th\n'
def test_no_blank_line(self, fp_without_any_blank_line): paragraph = read_until_blank_line(fp_without_any_blank_line) assert paragraph == '1st\n2nd\n3rd\n' rest = fp_without_any_blank_line.read() assert rest == ''
def update_current_par_and_line(f): cur_par = chef_utils.read_until_blank_line(f) cur_line = cur_par.split("\n", 1)[0] return cur_par, cur_line