Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Sep 23, 2023
1 parent 820f0b0 commit fca7c1e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 20 deletions.
11 changes: 2 additions & 9 deletions tests/parser/functions/test_minmax_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,8 @@ def foo():
a: {typ} = min_value({typ}) - 1
"""

if typ == UINT256_T:
assert_compile_failed(lambda: get_contract(upper), OverflowException)
else:
assert_compile_failed(lambda: get_contract(upper), InvalidType)

if typ == INT256_T:
assert_compile_failed(lambda: get_contract(lower), OverflowException)
else:
assert_compile_failed(lambda: get_contract(lower), InvalidType)
assert_compile_failed(lambda: get_contract(upper), OverflowException)
assert_compile_failed(lambda: get_contract(lower), OverflowException)


@pytest.mark.parametrize("typ", [DecimalT()])
Expand Down
4 changes: 2 additions & 2 deletions tests/parser/types/numbers/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

from vyper.compiler import compile_code
from vyper.exceptions import InvalidType
from vyper.exceptions import InvalidType, TypeMismatch
from vyper.utils import MemoryPositions


Expand Down Expand Up @@ -151,7 +151,7 @@ def test_custom_constants_fail(get_contract, assert_compile_failed, storage_type
def foo() -> {return_type}:
return MY_CONSTANT
"""
assert_compile_failed(lambda: get_contract(code), InvalidType)
assert_compile_failed(lambda: get_contract(code), TypeMismatch)


def test_constant_address(get_contract):
Expand Down
2 changes: 1 addition & 1 deletion tests/parser/types/numbers/test_decimals.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,4 @@ def foo() -> decimal:
return 2.2 ** 2.0
"""

assert_compile_failed(lambda: get_contract(code), TypeMismatch)
assert_compile_failed(lambda: get_contract(code), InvalidOperation)
5 changes: 1 addition & 4 deletions tests/parser/types/numbers/test_signed_ints.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,7 @@ def num_sub() -> {typ}:
return 1-2**{typ.bits}
"""

if typ.bits == 256:
assert_compile_failed(lambda: get_contract(code), OverflowException)
else:
assert_compile_failed(lambda: get_contract(code), InvalidType)
assert_compile_failed(lambda: get_contract(code), OverflowException)


ARITHMETIC_OPS = {
Expand Down
8 changes: 4 additions & 4 deletions tests/parser/types/test_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ def test_constant_list_fail(get_contract, assert_compile_failed, storage_type, r
def foo() -> {return_type}[3]:
return MY_CONSTANT
"""
assert_compile_failed(lambda: get_contract(code), InvalidType)
assert_compile_failed(lambda: get_contract(code), TypeMismatch)


@pytest.mark.parametrize("storage_type,return_type", itertools.permutations(integer_types, 2))
Expand All @@ -713,7 +713,7 @@ def test_constant_list_fail_2(get_contract, assert_compile_failed, storage_type,
def foo() -> {return_type}:
return MY_CONSTANT[0]
"""
assert_compile_failed(lambda: get_contract(code), InvalidType)
assert_compile_failed(lambda: get_contract(code), TypeMismatch)


@pytest.mark.parametrize("storage_type,return_type", itertools.permutations(integer_types, 2))
Expand Down Expand Up @@ -817,7 +817,7 @@ def test_constant_nested_list_fail(get_contract, assert_compile_failed, storage_
def foo() -> {return_type}[2][3]:
return MY_CONSTANT
"""
assert_compile_failed(lambda: get_contract(code), InvalidType)
assert_compile_failed(lambda: get_contract(code), TypeMismatch)


@pytest.mark.parametrize("storage_type,return_type", itertools.permutations(integer_types, 2))
Expand All @@ -831,4 +831,4 @@ def test_constant_nested_list_fail_2(
def foo() -> {return_type}:
return MY_CONSTANT[0][0]
"""
assert_compile_failed(lambda: get_contract(code), InvalidType)
assert_compile_failed(lambda: get_contract(code), TypeMismatch)

0 comments on commit fca7c1e

Please sign in to comment.