Interval exception detect when modify the lower or the upper property on an exist interval instance#48
Interval exception detect when modify the lower or the upper property on an exist interval instance#48Taktoshi wants to merge 12 commits intokvesteri:masterfrom
Conversation
…exist interval instance.
before fixing:
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
IntInterval('[3, 2]')
after fixing:
…exist interval instance.
before fixing:
>>> interval = IntInterval([1, 2])
>>> interval
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
IntInterval('[3, 2]')
after fixing:
>>> interval = IntInterval([1, 2])
>>> interval
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
it will raise the RangeBoundsException:
intervals.exc.RangeBoundsException: Min value 3 is bigger than max value 2.
…exist interval instance.
before fixing:
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
IntInterval('[3, 2]')
after fixing:
>>> interval = IntInterval([1, 2])
>>> interval
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
it will raise the RangeBoundsException:
intervals.exc.RangeBoundsException: Min value 3 is bigger than max value 2.
intervals/interval.py
Outdated
| isinstance(arg, self.type) or | ||
| isinstance(arg, type(self)) or | ||
| arg == inf or arg == -inf | ||
| isinstance(arg, list) or |
There was a problem hiding this comment.
Please remove this and all similar style changes where you add extra indents.
There was a problem hiding this comment.
I have revised all that changes.
| @mark.parametrize( | ||
| ('constructor', 'number_range', 'bad_upper'), | ||
| ( | ||
| (IntInterval, (1, 2), 0), |
There was a problem hiding this comment.
Use the indentation of 4 spaces not 8.
There was a problem hiding this comment.
The indentation has been revised to 4.
There was a problem hiding this comment.
There are still lines with indentation of 8 not 4
There was a problem hiding this comment.
OK, I will check again and change them.
…y on an exist interval instance.
before fixing:
>>> interval = IntInterval([1, 2])
>>> interval
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
IntInterval('[3, 2]')
after fixing:
>>> interval = IntInterval([1, 2])
>>> interval
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
it will raise the RangeBoundsException:
intervals.exc.RangeBoundsException: Min value 3 is bigger than max value 2.
…y on an exist interval instance.
before fixing:
>>> interval = IntInterval([1, 2])
>>> interval
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
IntInterval('[3, 2]')
after fixing:
>>> interval = IntInterval([1, 2])
>>> interval
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
it will raise the RangeBoundsException:
intervals.exc.RangeBoundsException: Min value 3 is bigger than max value 2.
…y on an exist interval instance.
before fixing:
>>> interval = IntInterval([1, 2])
>>> interval
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
IntInterval('[3, 2]')
after fixing:
>>> interval = IntInterval([1, 2])
>>> interval
IntInterval('[1, 2]')
>>> interval.lower = 3
>>> interval
it will raise the RangeBoundsException:
intervals.exc.RangeBoundsException: Min value 3 is bigger than max value 2.
|
@easybase Can I suggest you to have a look at https://github.com/AlexandreDecan/portion ? It's a Python library providing data structure and operations for intervals (atomic and interval sets). And we will be happy to accept pull requests, even the ones that do not comply style-wise ;-) Apologies, it's a bit of publicity for another project, but this repository does not seem to be really maintained anymore. |
Fix the bug of range exception detection when change the lower or the upper property. Add 12 new tests in test_initialization.py named class TestIntervalChanging.
before fixing:
IntInterval('[1, 2]')
IntInterval('[3, 2]')
after fixing:
IntInterval('[1, 2]')
it will raise the RangeBoundsException:
intervals.exc.RangeBoundsException: Min value 3 is bigger than max value 2.
Update the .travis.yml because the python3.3 can not download. So I change the archive for Trusty.