raise error for wrong input in ignore_variables#826
Conversation
Codecov Report
@@ Coverage Diff @@
## master #826 +/- ##
==========================================
+ Coverage 98.15% 98.15% +<.01%
==========================================
Files 121 121
Lines 10920 10939 +19
==========================================
+ Hits 10718 10737 +19
Misses 202 202
Continue to review full report at Codecov.
|
| if ignore_variables is not None: | ||
| # check if ignore_variables is not {str: list} | ||
| if not all(isinstance(i, str) for i in ignore_variables.keys()) or not all(isinstance(i, list) for i in ignore_variables.values()): | ||
| raise TypeError('ignore_variables should be dict[str -> list[str]]') |
There was a problem hiding this comment.
Could you add a test case that triggers this error?
| assert 'value' not in variables | ||
|
|
||
|
|
||
| @pytest.fixture |
There was a problem hiding this comment.
This shouldn't be a pytest fixture. Fixtures are functions that get used by the test cases. For example, this test case uses the es fixture, which returns an entityset.
|
Now it would be a good time to know if I should add the third check to see if the list is made of exclusively strings, and not say, ints or floats. |
|
That would be good to check as well. I think only the new "fixes" changelog entry is necessary. The "testing changes" section is for PRs that only change the tests. |
|
we should also test for the case where not all keys are string type |
Pull Request Description
As mentioned in #818, ignore_variables does not raise error when given a wrong input.
Currently it checks if the input is
{str: list}only, would like to know if its needed to check the values of the list to be string or not.After creating the pull request: in order to pass the changelog_updated check you will need to update the "Future Release" section of
docs/source/changelog.rstto include this pull request.