Skip to content

Replace assert with if statement (Fixes #32) #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 11, 2021
Merged

Replace assert with if statement (Fixes #32) #39

merged 3 commits into from
Feb 11, 2021

Conversation

SAK917
Copy link
Contributor

@SAK917 SAK917 commented Feb 11, 2021

Searched all the files in this library for assert statements and found one in each of mcp23008.py, mcp23016.py and mcp23017.py. Replaced assert statement with if statement raising a ValueError if the pin number passed is out-of-bounds (based on the value ranges in the original assert statements) and returning a more user-friendly error message indicating the correct range of pin values.

Happy to make any other changes necessary, just let me know if I need to do anything differently.

Replace assert stmt with if stmt raising a
ValueError if pin number is out of bounds.
Removed assert stmt and added if stmt returning a
ValueError if pin number is out of bounds.
Removed assert stmt and added if stmt returning a
ValueError if pin number is out of bounds.
@caternuson caternuson requested a review from a team February 11, 2021 22:02
@ladyada ladyada merged commit c84c901 into adafruit:master Feb 11, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 19, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_DotStar to 2.0.1 from 2.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_DotStar#51 from adafruit/REUSE
  > Hardcoded Black and REUSE versions
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_DS1841 to 1.0.4 from 1.0.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_DS1841#3 from adafruit/REUSE
  > Hardcoded Black and REUSE versions
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_LPS2X to 2.0.2 from 2.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_LPS2X#6 from adafruit/REUSE
  > Hardcoded Black and REUSE versions
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx to 2.4.4 from 2.4.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_MCP230xx#39 from SAK917/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel_SPI to 0.9.1 from 0.9.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_NeoPixel_SPI#27 from adafruit/REUSE
  > Hardcoded Black and REUSE versions
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 5.1.4 from 5.1.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#107 from kimmellr/request-header-fix

Updating https://github.com/adafruit/Adafruit_CircuitPython_TM to 1.0.2 from 1.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_TM#2 from imgrant/serial_number

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_Eddystone to 1.0.3 from 1.0.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_Eddystone#11 from adafruit/REUSE

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_iBBQ to 1.2.3 from 1.2.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_iBBQ#4 from adafruit/REUSE
  > Hardcoded Black and REUSE versions
  > Added pre-commit-config file
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.

2 participants