Skip to content

Handle incomparable values in Range#414

Merged
alecthomas merged 2 commits intoalecthomas:masterfrom
monopolis:incomparable-values-in-range
Nov 28, 2019
Merged

Handle incomparable values in Range#414
alecthomas merged 2 commits intoalecthomas:masterfrom
monopolis:incomparable-values-in-range

Conversation

@monopolis
Copy link
Copy Markdown
Contributor

In Python3, some values that are comparable in Python2, are no longer
comparable. One instance of this is None, which in Python2 is always
less than any other object. In Python3, however, a TypeError is raised
if it is used in a comparison.

This commit series adds unit tests for this in the Range validator, and follows it up with adding a fix for the error.

In Python3 some values that are comparable in Python2 are no longer
comparable. One instance of this is None, which in Python2 is always
less than any other object. In Python3, however, a TypeError is raised
if it is used in a comparison.

This commit handles said TypeError and issues a RangeInvalid exception
instead.
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.0%) to 94.324% when pulling f90e6a8 on monopolis:incomparable-values-in-range into f5e64dd on alecthomas:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.6%) to 94.655% when pulling f90e6a8 on monopolis:incomparable-values-in-range into f5e64dd on alecthomas:master.

@alecthomas
Copy link
Copy Markdown
Owner

Seems reasonable.

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.

3 participants