diff --git a/tests/parse/test_clear_notes.py b/tests/parse/test_clear_notes.py index 66f1201..a85f1ba 100644 --- a/tests/parse/test_clear_notes.py +++ b/tests/parse/test_clear_notes.py @@ -1,6 +1,18 @@ # SPDX-License-Identifier: LGPL-2.1-only # Copyright 2022 Jookia +# Clear notes syntax consists of the following: +# - One or more tokens or notes +# +# Parsing gives the following: +# All tokens that aren't notes +# +# The following error contexts are used: +# CLEAR_NOTES - Used when parsing the file +# +# The following parse errors are generated: +# FOUND_ENDNOTE - When a stray EndNote token is found + from hypothesis import given from hypothesis.strategies import composite, just, lists, one_of @@ -39,6 +51,9 @@ # Tests clear_notes filters out notes +# We expect the following behaviour: +# - Tokens that are part of note structures are removed +# template_test provides general parsing properties @given(draw_notes_to_clear()) def test_parse_clear_notes_valid(test_data): (tokens, result) = test_data @@ -47,7 +62,10 @@ assert cleared == result -# Tests clear_notes passes through skip_note errors +# Tests clear_notes passes through note errors +# We expect the following behaviour: +# - When an invalid note is parsed the error is propagated +# - Have ParseTask.CLEAR_NOTES as the context's parse task def test_parse_clear_notes_startnote_propagation(): tokens = static_note_invalid() parent_context = static_parse_context() @@ -57,6 +75,9 @@ # Tests clear_notes errors when finding an EndNote +# We expect the following behaviour: +# - When EndNote is found a ParseError.FOUND_ENDNOTE error is raised +# - Have ParseTask.CLEAR_NOTES as the context's parse task @given(lists(draw_note_value_token())) def test_parse_clear_notes_invalid_endnote(tokens): token = static_token_by_value("EndNote")