Skip to content
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

Overlap with empty range incorrectly returns True #7

Closed
gson1703 opened this issue May 17, 2017 · 5 comments
Closed

Overlap with empty range incorrectly returns True #7

gson1703 opened this issue May 17, 2017 · 5 comments
Assignees
Labels

Comments

@gson1703
Copy link

The overlap() method is documented as "Returns True if both ranges share any points."
The following example incorrectly prints True even though the ranges clearly do not share any points.

from spans import intrange
print intrange(20, 30).overlap(intrange(10, 10))

@runfalk
Copy link
Owner

runfalk commented May 17, 2017

This is indeed a bug. PostgreSQL does:

 # SELECT 'empty'::int4range && 'empty'::int4range;
 ?column? 
----------
 f
(1 row)

or

# SELECT int4range(1, 10, '[)') && 'empty'::int4range;
 ?column? 
----------
 f
(1 row)

@runfalk
Copy link
Owner

runfalk commented May 17, 2017

I've made a fix for this. Please test it and report back if it fixes your issue. The only changes file is types.py.

@runfalk runfalk added the bug label May 17, 2017
@runfalk runfalk self-assigned this May 17, 2017
@gson1703
Copy link
Author

The fix looks good to me. Thanks for the quick response!

@runfalk
Copy link
Owner

runfalk commented May 17, 2017

I'll release this fix as part of the 1.0 release. It'll probably be another week or two before that in case any other issues arise.

@runfalk runfalk closed this as completed May 17, 2017
@runfalk
Copy link
Owner

runfalk commented Jun 8, 2017

1.0.0 is now released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants