Skip to content

feat(mnemonic): add property-based tests for invalid cases - #3132

Merged
mkoura merged 3 commits into
masterfrom
add_mnemonic_property_based_tests
Sep 12, 2025
Merged

mkoura merged 3 commits into
masterfrom
add_mnemonic_property_based_tests

Conversation

@mkoura

@mkoura mkoura commented Sep 11, 2025

Copy link
Copy Markdown
Collaborator

Introduce property-based tests for mnemonic file validation using Hypothesis. Covers malformed files, invalid word counts, encoding issues, and permission errors. Refactor test parametrization to use shared constants. Improves robustness of CLI error handling for mnemonic derivation.

@mkoura
mkoura requested a review from saratomaz as a code owner September 11, 2025 18:23
@mkoura
mkoura requested a review from Copilot September 11, 2025 18:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Add property-based tests for mnemonic validation using Hypothesis to test invalid mnemonic files and CLI error handling. This improves test coverage for edge cases and malformed input scenarios.

  • Introduced comprehensive property-based testing strategies for invalid mnemonic cases including wrong word counts, unknown words, encoding issues, and filesystem edge cases
  • Refactored existing test parametrization to use shared constants for allowed mnemonic sizes
  • Added new test class for negative cases that validates CLI error handling for malformed mnemonic files

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cardano_node_tests/tests/test_mnemonic.py Added property-based test infrastructure with Hypothesis strategies for invalid mnemonic cases and new negative test class
cardano_node_tests/tests/common.py Added filter_too_much health check suppression to hypothesis_settings for property-based tests

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread cardano_node_tests/tests/test_mnemonic.py
Comment thread cardano_node_tests/tests/test_mnemonic.py
@mkoura
mkoura force-pushed the add_mnemonic_property_based_tests branch from 51d844d to e28205a Compare September 12, 2025 11:33
Introduce property-based tests for mnemonic file validation using Hypothesis.
Covers malformed files, invalid word counts, encoding issues, and permission
errors. Refactor test parametrization to use shared constants. Improves
robustness of CLI error handling for mnemonic derivation.
@mkoura
mkoura force-pushed the add_mnemonic_property_based_tests branch from e28205a to 43e8e59 Compare September 12, 2025 12:05
@mkoura
mkoura requested a review from Copilot September 12, 2025 12:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread cardano_node_tests/tests/test_mnemonic.py Outdated
Comment thread cardano_node_tests/tests/test_mnemonic.py Outdated
Comment thread cardano_node_tests/tests/test_mnemonic.py Outdated
Add property-based tests for `derive_from_mnemonic` to verify acceptance of
valid account numbers and rejection of invalid account/key numbers. Includes
hypothesis-based checks for boundary values and invalid types.
@mkoura
mkoura force-pushed the add_mnemonic_property_based_tests branch from 43e8e59 to 4e7ce5e Compare September 12, 2025 12:18
Refactor property-based tests for mnemonic generation to better handle
invalid word counts. Ensures zero is excluded from wrong count cases and
removes redundant hypothesis assumptions. This enhances test clarity and
coverage for edge cases.
@mkoura
mkoura requested a review from Copilot September 12, 2025 12:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mkoura
mkoura merged commit e7298ef into master Sep 12, 2025
3 checks passed
@mkoura
mkoura deleted the add_mnemonic_property_based_tests branch September 12, 2025 12:30
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.

2 participants