def test_parse_anonymous_blocks(): blocks = parser.parse_blocks([ '#%begin validate', 'validation', 'block', '#%end', '', 'command', 'block', ]) assert len(blocks) == 2
def test_parse_empty_blocks(): blocks = parser.parse_blocks([ '#%begin validate', 'validation', 'block', '#%end', '#%begin command', '', '', '#%end', ]) assert len(blocks) == 1
def test_parse_init_and_setup_blocks(): blocks = parser.parse_blocks([ '#%begin validate', 'validation', 'block', '#%end', '#%begin init', 'init', 'block', '#%end', '#%begin setup', 'setup', 'block', '#%end', '#%begin command', '', '', '#%end', ]) assert len(blocks) == 3
def test_parse_blocks_unsupported_type(): with pytest.raises(Exception): parser.parse_blocks(['#%begin unknown'])
def test_parse_blocks_no_block_type(): with pytest.raises(Exception): parser.parse_blocks(['#%begin'])