Skip to content

test: add fuzz testing using hypothesis - #57

Open
sumanjeet0012 wants to merge 2 commits into
multiformats:masterfrom
sumanjeet0012:fix-issue-43
Open

test: add fuzz testing using hypothesis#57
sumanjeet0012 wants to merge 2 commits into
multiformats:masterfrom
sumanjeet0012:fix-issue-43

Conversation

@sumanjeet0012

Copy link
Copy Markdown
Contributor

Fixes #43

Description

This pull request introduces fuzz testing for the py-multibase decoder. It implements the fuzz target using hypothesis to exercise the decode pipeline with random binary, string, and encoded permutations to ensure the package handles malformed input safely without crashing.

Changes

  • Installed hypothesis as a development dependency in pyproject.toml.
  • Added tests/test_fuzz.py containing:
    • test_decode_never_crashes
    • test_decode_string_never_crashes
    • test_roundtrip_never_crashes

@acul71 acul71 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.

Review (maintainer) — Request changes

Thanks for adding Hypothesis fuzz coverage for decode() — this aligns well with #43 and CI is green.

Blocker

Missing newsfragment for issue #43. Please add something like:

newsfragments/43.misc.rst

Added Hypothesis-based fuzz tests for ``decode()`` robustness.

(File must end with a newline.) Type misc or internal is appropriate for a test-only change.

Also recommended

  1. Rebase onto current origin/master (branch is ~6 commits behind; dry-run merge had no conflicts, but pyproject.toml overlaps with open #49 and #56).
  2. In test_roundtrip_never_crashes, when both encode and decode succeed, assert decoded == data so silent corruption cannot pass.
  3. Consider seeding Hypothesis with multibase spec vectors (closer to go-multibase FuzzDecode / the #43 proposal).

Validation (local)

  • make lint — pass
  • make typecheck — pass
  • make test — 269 passed
  • make docs-ci — pass

Full write-up: maintained locally as AI-PR-REVIEW-57-0.md.

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.

No fuzz testing for decode()

2 participants