Skip to content

Updates and improved testing - #7

Open
cardano-apexpool wants to merge 4 commits into
mainfrom
updates
Open

Updates and improved testing#7
cardano-apexpool wants to merge 4 commits into
mainfrom
updates

Conversation

@cardano-apexpool

Copy link
Copy Markdown
Owner

Improve test quality and code formatting.
Optimize integration tests to reduce API calls and avoid rate limits.
Implement comprehensive testing improvements.
Fix bugs and implement code quality improvements.

Bug fixes:
- Fix set instead of int bug in library.py exception handlers (line 70, 129)
- Add KeyError handling in get_error_message() for missing JSON keys
- Fix submit_tx to properly handle CBOR data with new koios_post_request_raw()
- Add missing pagination to get_credential_txs() in address.py
- Fix docstring parameter name mismatch in get_asset_txs() (block -> block_height)

Improvements:
- Add MAX_RETRIES (10) constant to prevent infinite retry loops
- Add MaxRetriesExceeded exception for better error handling
- Create paginated_get() and paginated_post() helper functions to reduce code duplication
- Replace wildcard imports with explicit imports in all modules
- Add specific type hints (list[dict[str, Any]] instead of list)
- Add deprecation warnings to get_asset_address_list() and get_asset_policy_info()
- Remove commented-out code in transactions.py
- Add __all__ export list in __init__.py for cleaner API surface
- Add pytest-cov, pytest-mock, and responses to requirements.txt
- Configure pytest with coverage reporting and test markers (unit/integration)
- Create tests/conftest.py with shared fixtures and test data constants
- Add unit tests for library.py with mocking (no network required)
- Update all existing tests with @pytest.mark.integration markers
- Refactor tests into class-based structure with better organization
- Add parametrized tests for limit/pagination testing
- Add negative test cases for empty inputs and edge cases
- Add response validation tests checking expected fields
- Update tox.ini with separate unit, integration, and coverage environments
- Update CI workflow with Python 3.10-3.12 matrix and coverage reporting
- Separate unit tests (fast, offline) from integration tests (network required)
- Remove parametrized tests for functions without limit params (get_pool_list, get_pool_relays)
- Use specific epoch for get_totals() instead of fetching all epochs
- Use logo=False for get_asset_token_registry to reduce response size
- Consolidate duplicate test methods that made same API calls
- Remove redundant parametrized epoch tests
- Remove unnecessary pass statement and else-after-return in library.py
- Update test pool ID and expected values to match current blockchain state
- Simplify parameterized tests to reduce API calls
- Add pylint disable comments for small test classes
- Remove unused imports across test files
- Improve code formatting (multi-line lists, import grouping)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant