Skip to content

Commit

Permalink
remove duplicate tests after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
sandbubbles committed Jan 3, 2025
1 parent b49283f commit 68a2835
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 139 deletions.
89 changes: 0 additions & 89 deletions tests/functional/codegen/test_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,92 +981,3 @@ def test_weird_interface_name():
"external_interface"
]
assert "interface _:" in out


def test_intrinsic_interface_instantiation(make_input_bundle, get_contract):
lib1 = """
@external
@view
def foo():
pass
"""
main = """
import lib1
i: lib1.__interface__
@external
def bar() -> lib1.__interface__:
self.i = lib1.__at__(self)
return self.i
"""
input_bundle = make_input_bundle({"lib1.vy": lib1})
c = get_contract(main, input_bundle=input_bundle)

assert c.bar() == c.address


def test_intrinsic_interface_converts(make_input_bundle, get_contract):
lib1 = """
@external
@view
def foo():
pass
"""
main = """
import lib1
@external
def bar() -> lib1.__interface__:
return lib1.__at__(self)
"""
input_bundle = make_input_bundle({"lib1.vy": lib1})
c = get_contract(main, input_bundle=input_bundle)

assert c.bar() == c.address


def test_intrinsic_interface_kws(env, make_input_bundle, get_contract):
value = 10**5
lib1 = f"""
@external
@payable
def foo(a: address):
send(a, {value})
"""
main = f"""
import lib1
exports: lib1.__interface__
@external
def bar(a: address):
extcall lib1.__at__(self).foo(a, value={value})
"""
input_bundle = make_input_bundle({"lib1.vy": lib1})
c = get_contract(main, input_bundle=input_bundle)
env.set_balance(c.address, value)
original_balance = env.get_balance(env.deployer)
c.bar(env.deployer)
assert env.get_balance(env.deployer) == original_balance + value


def test_intrinsic_interface_defaults(env, make_input_bundle, get_contract):
lib1 = """
@external
@payable
def foo(i: uint256=1) -> uint256:
return i
"""
main = """
import lib1
exports: lib1.__interface__
@external
def bar() -> uint256:
return extcall lib1.__at__(self).foo()
"""
input_bundle = make_input_bundle({"lib1.vy": lib1})
c = get_contract(main, input_bundle=input_bundle)
assert c.bar() == 1
50 changes: 0 additions & 50 deletions tests/functional/syntax/test_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,56 +600,6 @@ def bar():
compiler.compile_code(main, input_bundle=input_bundle)


@pytest.mark.xfail
def test_intrinsic_interfaces_default_function(make_input_bundle, get_contract):
lib1 = """
@external
@payable
def __default__():
pass
"""
main = """
import lib1
@external
def bar():
extcall lib1.__at__(self).__default__()
"""
input_bundle = make_input_bundle({"lib1.vy": lib1})

# TODO make the exception more precise once fixed
with pytest.raises(Exception): # noqa: B017
compiler.compile_code(main, input_bundle=input_bundle)


def test_intrinsic_interfaces_different_types(make_input_bundle, get_contract):
lib1 = """
@external
@view
def foo():
pass
"""
lib2 = """
@external
@view
def foo():
pass
"""
main = """
import lib1
import lib2
@external
def bar():
assert lib1.__at__(self) == lib2.__at__(self)
"""
input_bundle = make_input_bundle({"lib1.vy": lib1, "lib2.vy": lib2})

with pytest.raises(TypeMismatch):
compiler.compile_code(main, input_bundle=input_bundle)


def test_intrinsic_interfaces_default_function(make_input_bundle, get_contract):
lib1 = """
@external
Expand Down

0 comments on commit 68a2835

Please sign in to comment.