-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Unit tests for untested methods of tardis/util.py #507
Conversation
- Three new methods introduced in test_util.py, of them the first method tests MalformedSpeciesError, second method tests MalformedElementsSymbolError, third method tests MalformedQuantityError. - All 3 classes inherit from an empty MalformedError so MalformedError itself does not need unit test.
09adfcc
to
71bc70d
Compare
- Indentation was kept 3x spaces, increased to 4x. - Parameter 'input' shadowed built-in name input, so rename it to 'int_input'. - Adds param and returns description in docstring, makes the doctests shorter and more precise. - Replaces deprecated style of raising exceptions. - Removes C-style for-in range looping to a better and more pythonic style 'enumerate'.
- numpy, scipy, pandas and matplotlib versions were increased in conda-requirements.
- astropy==1.0.4 and numpy==1.10.0 cannot work together. numpy==1.10.0 is required to solve libgfortran issue, so astropy is changed from 1.0.4 to 1.0.5 - Same case for pytables==3.2 hence is changed to 3.2.2
f10d13e
to
eda1bbf
Compare
- Adds testcase for raising MalformedElementSymbolError in element_symbol2atomic_number. - Combines tests for test_parse_quantity into one test, and adds testcases for raising MalformedQuantityError.
- Coverage for various exceptions raised by the species_string_to_tuple method. Similarly for species_tuple_to_string method.
|
- Rearranged tests in same order as they are in 'tardis/util.py'. - Fixed pep8 violations and the testcases in pytest decorators were reorganized as one per line for better readability.
- Indentation was kept 3x, increased to 4x. - Parameters 'input and 'sum' shadowed built-in names, so changed them to 'roman_input' and 'result'. - Adds 'param' and 'returns' description in the docstring. - Replaces deprecated style of raising exceptions.
(10 , 'X'), (9 , 'IX'), (5 , 'V'), (4 , 'IV'), (1, 'I')] | ||
|
||
result = '' | ||
for iterable, int_roman_tuple in enumerate(int_roman_tuples): |
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 don't think you need enumerate here. There must be a way to iterate and get int and str directly from the loop.
for int, str in int_roman_tuples:
Something like that but working(haven't tested only guessed that it won't that easily).
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.
Okay, I am working upon it.
@wkerzendorf @unoebauer @yeganer Is this relevant or should I close ? (Made before applying to demonstrate coding capability). |
As far as I see it, parts of the ulit.py are no longer used or relevant. We should go over it at some point and figure out which of the tools therein are still relevant and which not. Afterwards, we can then worry about unit tests for those. For now I wouldn't worry about it. But let's leave the PR open so we don't forget :) |
This PR will be consisting a series of commits targetting to improve code coverage of tardis/utils.py.
This checklist maintains the methods/ classes present in tardis/utils.py on 05 March 2016, the day when #506 was created. The commits enclosed in brackets show where these tests were modified/ added.