Page MenuHomeSoftware Heritage

Draw contents from a byte string instead of generating arbitrary hashes
ClosedPublic

Authored by olasd on Mar 2 2020, 2:07 PM.

Details

Summary

This generates more realistic contents and avoids spurious HashCollisions when
generating a set of objects using these hypothesis strategies, at the cost of
slightly worse "boundary checking" (i.e. we won't check contents with a length >
4096 bytes).

Depends on D2738.

Test Plan

tox tests still pass

Diff Detail

Repository
rDMOD Data model
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

This revision is now accepted and ready to land.Mar 2 2020, 2:12 PM
swh/model/hypothesis_strategies.py
152

Maybe use the swh.model.hashutil.DEFAULT_ALGORITHMS variable?

swh/model/hypothesis_strategies.py
152

The list of attributes is somewhat hardcoded in swh.model.model, so I elected not to do that.