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(fw): make exception classes kw_only dataclasses to improve testability #386

Conversation

danceratopz
Copy link
Member

@danceratopz danceratopz commented Jan 18, 2024

🗒️ Description

This PR makes the custom exception classes defined in ethereum_test_tools.common.types as kw_only dataclasses.

The primary aim is to make it easier to test these exception classes; dataclasses automatically get a __eq__() method which can be used for comparison in tests. Applying kw_only also helps readability.

🔗 Related Issues

Should help improve PR #350 (respectively #380).

✅ Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • Not applicable Tests: Included the type and version of evm t8n tool used to locally execute test cases: e.g., ref with commit hash or geth 1.13.1-stable-3f40e65.
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.

The main aim of this change is to make it easier to test the exception classes defined in `ethereum_test_tools.common.types` as dataclasses automatically get a `__eq__()` method. Applying `kw_only` should help with readability.
@danceratopz danceratopz added type:refactor Type: Refactor scope:fw Scope: Framework (evm|tools|forks|pytest) labels Jan 18, 2024
Copy link
Collaborator

@spencer-tb spencer-tb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danceratopz danceratopz merged commit afb3164 into ethereum:main Jan 18, 2024
5 checks passed
danceratopz added a commit to spencer-tb/execution-spec-tests that referenced this pull request Jan 18, 2024
danceratopz added a commit to spencer-tb/execution-spec-tests that referenced this pull request Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:fw Scope: Framework (evm|tools|forks|pytest) type:refactor Type: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants