pbcabi/test/test_parse_abi.py
Jon Michael Aanes 959ceff255
Some checks failed
Verify Python project can be installed, loaded and have version checked / Test (push) Waiting to run
Run Python tests (through Pytest) / Test (push) Has been cancelled
Ruff
2025-05-21 00:55:57 +02:00

25 lines
658 B
Python

from pathlib import Path
import pytest
import pbcabi.model
from pbcabi.binaryreader import BinaryReader
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')
]
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:
contract_abi = pbcabi.model.FileAbi.read_from(BinaryReader(f.read()))
assert contract_abi is not None