diff --git a/tests/parse/templates.py b/tests/parse/templates.py index 1ba0283..a06d294 100644 --- a/tests/parse/templates.py +++ b/tests/parse/templates.py @@ -1,12 +1,10 @@ # SPDX-License-Identifier: LGPL-2.1-only # Copyright 2022 Jookia -from hypothesis import given from hypothesis.strategies import composite, integers from src.parse import ParseErrorException from src.token import TokenStream -from tests.parse.test_error import static_parse_context from tests.test_token import static_token_by_value @@ -51,44 +49,3 @@ except ParseErrorException as e: error = e assert error == expected - - -# Deprecated: Do not use -# Tests that something parses correctly with a custom parser -# We expect the following behaviour: -# - The decorated function supplies a parser, test data and expected data -# - Only the supplied tokens are parsed -# - The supplied tokens parse to the expected value -# - The Token's value is the expected value -# - The Token's location is the first token's location -def template_parse_valid_composite(func): - @given(composite(func)()) - def do(test_data): - (parser, tokens, expected) = test_data - return template_test_valid(parser, tokens, expected) - - return do - - -# Deprecated: Do not use -# Test that something parses incorrectly with a custom parser -# We expect the following behaviour: -# - The decorated function takes a parse context -# - The decorated function generates a parser, input tokens and an error -# - Parsing causes an error -# - The parse error is as expected -def template_parse_invalid_composite(func): - # Wrapper to add parse_context to our test_data - @composite - def wrapper(draw): - context = static_parse_context() - (parser, tokens, error) = draw(composite(func)(context)) - return (parser, tokens, error, context) - - # test_data is the output of wrapper - @given(wrapper()) - def do(test_data): - (parser, tokens, error, context) = test_data - return template_test_invalid(parser, context, tokens, error) - - return do