gh-107862: Add roundtrip hypothesis tests to test_binascii#107863
gh-107862: Add roundtrip hypothesis tests to test_binascii#107863hauntsaninja merged 1 commit intopython:mainfrom
hypothesis tests to test_binascii#107863Conversation
|
Closing and re-opening to retrigger CLA checks. Sorry for the noise. |
hauntsaninja
left a comment
There was a problem hiding this comment.
Thanks for working on this!
| @hypothesis.given(binary=hypothesis.strategies.binary()) | ||
| def test_hex_roundtrip(self, binary): | ||
| converted = binascii.hexlify(self.type2test(binary)) | ||
| restored = binascii.unhexlify(self.type2test(converted)) |
There was a problem hiding this comment.
Wonder if unhexlify should also take a sep and bytes_per_sep argument
|
Btw, @rhettinger was against doing this. |
|
I agree that we shouldn't rely on Hypothesis' strategies as a substitute for fixed tests. But I think the implementation chosen for adding property based tests in CPython is quite sensible! None of the Hypothesis strategies run by default in our test suite. Hypothesis is stubbed out and simply used used as a DSL to write property based tests where For this specific PR, I guess maybe I should have asked Nikita to add some specific (I also obviously agree we shouldn't use Hypothesis to write tests to enforce properties that are not actually properties, like the colorsys example) |
Uh oh!
There was an error while loading. Please reload this page.