diff --git a/tests/parser/syntax/test_dynamic_array.py b/tests/parser/syntax/test_dynamic_array.py index 025a460758..48ab6f0d92 100644 --- a/tests/parser/syntax/test_dynamic_array.py +++ b/tests/parser/syntax/test_dynamic_array.py @@ -1,7 +1,7 @@ import pytest from vyper import compiler -from vyper.exceptions import ArrayIndexException, StructureException +from vyper.exceptions import StructureException fail_list = [ ( diff --git a/tests/parser/syntax/test_for_range.py b/tests/parser/syntax/test_for_range.py index e6f35c1d2d..ab852ada37 100644 --- a/tests/parser/syntax/test_for_range.py +++ b/tests/parser/syntax/test_for_range.py @@ -1,7 +1,7 @@ import pytest from vyper import compiler -from vyper.exceptions import StructureException +from vyper.exceptions import InvalidType, StructureException, TypeMismatch fail_list = [ ( @@ -16,6 +16,15 @@ def foo(): ( """ @external +def bar(): + for i in range(1,2,bound=0): + pass + """, + StructureException, + ), + ( + """ +@external def bar(): for i in range(1,2,bound=2): pass @@ -32,6 +41,48 @@ def bar(): """, StructureException, ), + ( + """ +@external +def bar(): + x:uint256 = 1 + y:uint256 = 2 + for i in range(x,y+1): + pass + """, + StructureException, + ), + ( + """ +@external +def bar(): + x:uint256 = 1 + for i in range(x,x+0): + pass + """, + StructureException, + ), + ( + """ +@external +def bar(x: uint256): + for i in range(3, x): + pass + """, + InvalidType, + ), + ( + """ +FOO: constant(int128) = 3 +BAR: constant(uint256) = 7 + +@external +def foo(): + for i in range(FOO, BAR): + pass + """, + TypeMismatch, + ), ]