Skip to content

Commit

Permalink
mcp23017.py - Change assert to if in get_pin()
Browse files Browse the repository at this point in the history
Removed assert stmt and added if stmt returning a
ValueError if pin number is out of bounds.
  • Loading branch information
SAK917 committed Feb 11, 2021
1 parent 44471b7 commit 1334c4d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion adafruit_mcp230xx/mcp23017.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ def get_pin(self, pin):
"""Convenience function to create an instance of the DigitalInOut class
pointing at the specified pin of this MCP23017 device.
"""
assert 0 <= pin <= 15
if not 0 <= pin <= 15:
raise ValueError("Pin number must be 0-15.")
return DigitalInOut(pin, self)

@property
Expand Down

0 comments on commit 1334c4d

Please sign in to comment.