Repository navigation
test: add comprehensive roundtrip tests and fix leading zeros bug - #55
sumanjeet0012 wants to merge 3 commits into
Conversation
f2bf2f3 to
4033614
Compare
acul71
left a comment
There was a problem hiding this comment.
Review (maintainer)
Thanks for the thorough round-trip coverage and the leading-zeros fix in BaseStringConverter / Base16StringConverter. This looks like the preferred fix relative to overlapping PR #48 (similar converter changes): #55 has green CI and broader tests aligned with #40.
Blocker
Missing newsfragment — please add newsfragments/40.bugfix.rst with a short user-facing note that leading zero bytes are preserved for integer-based multibase encodings, ending with a trailing newline. This is mandatory before approval.
Also note
- Branch is 6 commits behind
origin/master(dry-run merge is clean; please rebase/merge when convenient). - Minor:
encodestill shadows the builtin namebytes; Base16 decode comment still mentions case normalization after switching tobytes.fromhex.
Validation
Local make lint, typecheck, test (362 passed), and docs-ci all passed. GitHub checks are green.
Request changes until the newsfragment is added; happy to re-review promptly after that.
|
Hi @sumanjeet0012 — friendly follow-up. I requested changes on this PR on 2026-09-07 (mainly the missing towncrier newsfragment, plus the other notes in that review). I don’t see any new commits addressing those items yet. Are you still willing / able to carry this PR forward? If yes, please push the requested updates when you can and I’ll re-review promptly. If your bandwidth has changed, no worries — just say so and we can close it or leave it for someone else to pick up. |
🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
2146645 to
73131c9
Compare
Fixes #40
Description
This pull request adds comprehensive round-trip tests with random data to verify that all encodings in
py-multibasecorrectly handle various data shapes, including leading zero bytes and extreme sizes. In addition, it fixes a bug whereBaseStringConverterwas incorrectly dropping leading zeros upon encoding/decoding.Changes
tests/test_roundtrip.pywith random data generators covering all 24 supported encodings (e.g.base2,base8,base10,base16,base32z,base36,base58btc, etc.).b'\x00\x00'), all ones (b'\xff\xff'), and leading zeroes (b'\x00hello').BaseStringConverter.encodeanddecodeinmultibase/converters.pyto correctly preserve leading zero bytes manually, asint.from_bytesnaturally truncates them.Base16StringConverter.decodeinmultibase/converters.pyto usebytes.fromhex()instead of relying on the integer representation decoding.