Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: test directory structure #3664

Merged
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
217 changes: 0 additions & 217 deletions tests/base_conftest.py

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,36 @@ def foo(a: {data_type}) -> uint256:

c = get_contract(code)
assert c.foo(0) == 0


def test_ext_call(w3, side_effects_contract, assert_side_effects_invoked, get_contract):
code = """
@external
def foo(a: Foo) -> uint256:
return as_wei_value(a.foo(7), "ether")

interface Foo:
def foo(x: uint8) -> uint8: nonpayable
"""

c1 = side_effects_contract("uint8")
c2 = get_contract(code)

assert c2.foo(c1.address) == w3.to_wei(7, "ether")
assert_side_effects_invoked(c1, lambda: c2.foo(c1.address, transact={}))


def test_internal_call(w3, get_contract_with_gas_estimation):
code = """
@external
def foo() -> uint256:
return as_wei_value(self.bar(), "ether")

@internal
def bar() -> uint8:
return 7
"""

c = get_contract_with_gas_estimation(code)

assert c.foo() == w3.to_wei(7, "ether")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO: check, this is probably redundant with examples/test_crowdfund.py
def test_crowdfund(w3, tester, get_contract_with_gas_estimation_for_constants):
crowdfund = """

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading