forked from vyperlang/vyper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_create_with_code_of.py
More file actions
49 lines (41 loc) · 972 Bytes
/
test_create_with_code_of.py
File metadata and controls
49 lines (41 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import pytest
from pytest import (
raises,
)
from vyper import (
compiler,
)
fail_list = [
"""
@public
def foo():
x: address = create_forwarder_to(0x1234567890123456789012345678901234567890, value=4, value=9)
"""
]
@pytest.mark.parametrize('bad_code', fail_list)
def test_type_mismatch_exception(bad_code):
with raises(SyntaxError):
compiler.compile_code(bad_code)
valid_list = [
"""
@public
def foo():
x: address = create_forwarder_to(0x1234567890123456789012345678901234567890)
""",
"""
@public
def foo():
x: address = create_forwarder_to(
0x1234567890123456789012345678901234567890,
value=as_wei_value(9, "wei")
)
""",
"""
@public
def foo():
x: address = create_forwarder_to(0x1234567890123456789012345678901234567890, value=9)
"""
]
@pytest.mark.parametrize('good_code', valid_list)
def test_rlp_success(good_code):
assert compiler.compile_code(good_code) is not None