def test_parse_header(): lines = ['# some header', '# is here', '', 'this is not a header'] assert parse_block(lines, header=True) == ['# some header', '# is here'] assert lines == ['', 'this is not a header'] lines = ['this is not a header'] assert parse_block(lines, header=True) == [] assert lines == ['this is not a header']
def test_parse_block(): # a normal block lines = ['a: 42', 'b: 17', '', 'c: 19'] assert parse_block(lines) == ['a: 42', 'b: 17'] assert lines == ['', 'c: 19'] # a block at the end lines = ['c: 19'] assert parse_block(lines) == ['c: 19'] assert lines == [] # no block lines = [] assert parse_block(lines) == [] assert lines == []