adafruit / circuitmatter

Pure Python implementation of the Matter IOT protocol
MIT License
21 stars 3 forks source link

Add hypothesis tests and bounds checks on Integers #1

Closed CharString closed 3 months ago

CharString commented 3 months ago

These are the kind of tests I meant during the Deep Dive stream.

Writing them they let me discover there were no bounds checks. I leave it as an exercise to the reader to add the round trip tests for signed integers and other bit-sized unsigned integers.

I haven't gotten to the more interesting cases: the nested structures. Hypothesis can be used to create arbitrary nested structures for these.

tannewt commented 3 months ago

Ah! Thank you! Want to run ruff via pre-commit or should I?

CharString commented 3 months ago

I will in a moment. Nice to see you added a formatter, I turned mine off to not change the rest of the code... :)

Sent from Proton Mail Android

-------- Original Message -------- On 18/07/2024 18:55, Scott Shawcroft wrote:

Ah! Thank you! Want to run ruff via pre-commit or should I?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

CharString commented 3 months ago

@tannewt There you go. I've change the CI job to install the test dependencies enumerated in the pyproject.toml.