-
-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use pytest.raises instead of assert_compile_failed
- Loading branch information
Showing
17 changed files
with
75 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import pytest | ||
|
||
from vyper.compiler import compile_code | ||
from vyper import compile_code | ||
|
||
valid_list = [ | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
import pytest | ||
|
||
from vyper import compile_code | ||
from vyper.exceptions import InvalidType | ||
|
||
fail_list = [ | ||
""" | ||
( | ||
""" | ||
FOO: constant(address) = epsilon(address) | ||
""" | ||
""", | ||
InvalidType, | ||
) | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("bad_code", fail_list) | ||
def test_block_fail(assert_compile_failed, get_contract_with_gas_estimation, bad_code): | ||
assert_compile_failed(lambda: get_contract_with_gas_estimation(bad_code), InvalidType) | ||
@pytest.mark.parametrize("bad_code,exc", fail_list) | ||
def test_block_fail(bad_code, exc): | ||
with pytest.raises(exc): | ||
compile_code(bad_code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import pytest | ||
|
||
from vyper.compiler import compile_code | ||
from vyper import compile_code | ||
|
||
valid_list = [ | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,39 @@ | ||
import pytest | ||
|
||
from vyper import compile_code | ||
from vyper.exceptions import InvalidType | ||
|
||
fail_list = [ | ||
""" | ||
( | ||
""" | ||
@external | ||
def foo(): | ||
a: address = min_value(address) | ||
""", | ||
""" | ||
InvalidType, | ||
), | ||
( | ||
""" | ||
@external | ||
def foo(): | ||
a: address = max_value(address) | ||
""", | ||
""" | ||
InvalidType, | ||
), | ||
( | ||
""" | ||
FOO: constant(address) = min_value(address) | ||
@external | ||
def foo(): | ||
a: address = FOO | ||
""", | ||
InvalidType, | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("bad_code", fail_list) | ||
def test_block_fail(assert_compile_failed, get_contract_with_gas_estimation, bad_code): | ||
assert_compile_failed(lambda: get_contract_with_gas_estimation(bad_code), InvalidType) | ||
@pytest.mark.parametrize("bad_code,exc", fail_list) | ||
def test_block_fail(bad_code, exc): | ||
with pytest.raises(exc): | ||
compile_code(bad_code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters