-
Notifications
You must be signed in to change notification settings - Fork 17
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
Interval exception detect when modify the lower or the upper property on an exist interval instance #48
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this and all similar style changes where you add extra indents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have revised all that changes.
@mark.parametrize( | ||
('constructor', 'number_range', 'bad_upper'), | ||
( | ||
(IntInterval, (1, 2), 0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the indentation of 4 spaces not 8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation has been revised to 4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still lines with indentation of 8 not 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.