Skip to content

Commit

Permalink
test: Tests can raise either internal or Python syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Nov 28, 2019
1 parent 797eb3d commit 01bd2af
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/parser/types/test_identifier_naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from vyper.exceptions import (
FunctionDeclarationException,
PythonSyntaxException,
VariableDeclarationException,
)
from vyper.functions import (
Expand Down Expand Up @@ -31,13 +32,15 @@ def test_reserved_keywords_memory(constant, get_contract, assert_compile_failed)
def test():
{constant}: int128 = 31337
"""
assert_compile_failed(lambda: get_contract(code), VariableDeclarationException)
assert_compile_failed(lambda: get_contract(code),
(PythonSyntaxException, VariableDeclarationException))


@pytest.mark.parametrize('constant', ALL_RESERVED_KEYWORDS)
def test_reserved_keywords_storage(constant, get_contract, assert_compile_failed):
code = f"{constant}: int128"
assert_compile_failed(lambda: get_contract(code), VariableDeclarationException)
assert_compile_failed(lambda: get_contract(code),
(PythonSyntaxException, VariableDeclarationException))


@pytest.mark.parametrize('constant', ALL_RESERVED_KEYWORDS)
Expand All @@ -47,7 +50,8 @@ def test_reserved_keywords_fn_args(constant, get_contract, assert_compile_failed
def test({constant}: int128):
pass
"""
assert_compile_failed(lambda: get_contract(code), FunctionDeclarationException)
assert_compile_failed(lambda: get_contract(code),
(PythonSyntaxException, FunctionDeclarationException))


@pytest.mark.parametrize('constant', ALL_RESERVED_KEYWORDS)
Expand All @@ -57,4 +61,5 @@ def test_reserved_keywords_fns(constant, get_contract, assert_compile_failed):
def {constant}(var: int128):
pass
"""
assert_compile_failed(lambda: get_contract(code), FunctionDeclarationException)
assert_compile_failed(lambda: get_contract(code),
(PythonSyntaxException, FunctionDeclarationException))

0 comments on commit 01bd2af

Please sign in to comment.