Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Mar 4, 2024
1 parent d4a94c5 commit ef92f79
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions tests/unit/ast/nodes/test_hex.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,36 @@
foo: constant(address) = 0x6b175474e89094c44da98b954eedeac495271d0F
""",
"""
foo: constant(address[1]) = [0x6b175474e89094c44da98b954eedeac495271d0F]
""",
"""
@external
def foo():
bar: address = 0x6b175474e89094c44da98b954eedeac495271d0F
""",
"""
@external
def foo():
bar: address[1] = [0x6b175474e89094c44da98b954eedeac495271d0F]
""",
"""
@external
def foo():
for i: address in [0x6b175474e89094c44da98b954eedeac495271d0F]:
pass
""",
]


@pytest.mark.parametrize("code", code_invalid_checksum)
def test_bad_checksum_address(code, dummy_input_bundle):
vyper_module = vy_ast.parse_to_ast(code)

with pytest.raises(BadChecksumAddress):
semantics.validate_semantics(vyper_module, dummy_input_bundle)
vyper_module = vy_ast.parse_to_ast(code)
semantics.analyze_module(vyper_module, dummy_input_bundle)


code_invalid_literal = [
"""
foo: constant(address[1]) = [0x6b175474e89094c44da98b954eedeac495271d0F]
""",
"""
@external
def foo():
for i: address in [0x6b175474e89094c44da98b954eedeac495271d0F]:
pass
""",
"""
@external
def foo():
bar: address[1] = [0x6b175474e89094c44da98b954eedeac495271d0F]
""",
"""
foo: constant(bytes20) = 0x6b175474e89094c44da98b954eedeac495271d0F
""",
"""
Expand All @@ -50,8 +49,6 @@ def test_bad_checksum_address(code, dummy_input_bundle):

@pytest.mark.parametrize("code", code_invalid_literal)
def test_invalid_literal(code, dummy_input_bundle):
vyper_module = vy_ast.parse_to_ast(code)

with pytest.raises(InvalidLiteral):
vyper_module = vy_ast.parse_to_ast(code)
semantics.validate_semantics(vyper_module, dummy_input_bundle)
semantics.analyze_module(vyper_module, dummy_input_bundle)

0 comments on commit ef92f79

Please sign in to comment.