generated from ApeWorX/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b63aad7
commit 6810466
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from pathlib import Path | ||
from tempfile import NamedTemporaryFile | ||
|
||
import pytest | ||
|
||
from ape_vyper._cli import cli | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"contract_name,expected", | ||
[ | ||
# This first one has most known edge cases | ||
( | ||
"flatten_me.vy", | ||
[ | ||
"from vyper.interfaces import ERC20", | ||
"interface Dep:", | ||
"interface IFace:", | ||
"interface IFaceTwo:", | ||
], | ||
), | ||
], | ||
) | ||
def test_cli_flatten(project, contract_name, expected, cli_runner): | ||
path = project.contracts_folder / contract_name | ||
with NamedTemporaryFile() as tmpfile: | ||
result = cli_runner.invoke(cli, ["flatten", str(path), tmpfile.name]) | ||
assert result.exit_code == 0, result.stderr_bytes | ||
output = Path(tmpfile.name).read_text() | ||
for expect in expected: | ||
assert expect in output |