Skip to content

Commit

Permalink
fix implements tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberthirst committed Oct 27, 2024
1 parent 12da260 commit 07bd5e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tests/functional/codegen/modules/test_interface_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ def test_import_interface_flags(make_input_bundle, get_contract):
MOO
POO
interface IFoo:
def foo() -> Foo: nonpayable
@nonpayable
def foo() -> Foo:
...
"""

contract = """
Expand Down
3 changes: 3 additions & 0 deletions tests/functional/codegen/test_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def test_log_interface_event(make_input_bundle, assert_compile_failed):
interface_code = """
event Foo:
a: uint256
def bar() -> uint256:
...
"""

input_bundle = make_input_bundle({"a.vyi": interface_code})
Expand Down
12 changes: 10 additions & 2 deletions tests/unit/compiler/test_abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,19 +458,27 @@ def bar():
def test_event_no_export_implements(make_input_bundle):
# test events are not exported even if they are in implemented interface
ifoo = """
@external
def foo():
...
event MyEvent:
pass
"""
main = """
import ifoo
implements: ifoo
@external
def foo():
pass
"""
input_bundle = make_input_bundle({"ifoo.vyi": ifoo})
out = compile_code(main, input_bundle=input_bundle, output_formats=["abi"])
expected = {"abi": []}

assert out == expected
assert len(out["abi"]) == 1
assert out["abi"][0]["name"] == "foo"


def test_event_export_interface(make_input_bundle):
Expand Down

0 comments on commit 07bd5e3

Please sign in to comment.