1
0
pbcabi/test/test_parse_abi.py

19 lines
648 B
Python
Raw Normal View History

2024-04-08 11:44:19 +00:00
import pytest
from pathlib import Path
from pbcabi.binaryreader import BinaryReader
import pbcabi.model
EXAMPLE_ABIS_FOLDER = Path.cwd() / 'test' / 'example-abis'
EXAMPLE_ABIS = [str(p.relative_to(EXAMPLE_ABIS_FOLDER)) for p in EXAMPLE_ABIS_FOLDER.glob('*.abi')]
2024-04-08 11:44:19 +00:00
def test_parse_abi_num():
print(EXAMPLE_ABIS_FOLDER)
print(EXAMPLE_ABIS)
assert len(EXAMPLE_ABIS) > 0
@pytest.mark.parametrize('abi_file_path', EXAMPLE_ABIS)
def test_parse_abi(abi_file_path):
with open(EXAMPLE_ABIS_FOLDER / abi_file_path, 'rb') as f:
2024-04-08 11:44:19 +00:00
contract_abi = pbcabi.model.FileAbi.read_from(BinaryReader(f.read()))
assert contract_abi is not None