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

raise error for wrong input in ignore_variables #826

Merged
merged 13 commits into from
Nov 30, 2019

Conversation

systemshift
Copy link
Contributor

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.rst to include this pull request.

@codecov-io
Copy link

codecov-io commented Nov 22, 2019

Codecov Report

Merging #826 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #826      +/-   ##
==========================================
+ Coverage   98.15%   98.15%   +<.01%     
==========================================
  Files         121      121              
  Lines       10920    10939      +19     
==========================================
+ Hits        10718    10737      +19     
  Misses        202      202
Impacted Files Coverage Δ
featuretools/synthesis/deep_feature_synthesis.py 97.04% <100%> (+0.02%) ⬆️
...ols/tests/synthesis/test_deep_feature_synthesis.py 99.09% <100%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0783ccc...28db64f. Read the comment docs.

@@ -165,6 +165,9 @@ def __init__(self,

self.ignore_variables = defaultdict(set)
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]]')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test case that triggers this error?

@@ -162,6 +162,18 @@ def test_ignores_variables(es):
assert 'value' not in variables


@pytest.fixture
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@systemshift
Copy link
Contributor Author

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.

@rwedge
Copy link
Contributor

rwedge commented Nov 26, 2019

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.

@rwedge
Copy link
Contributor

rwedge commented Nov 30, 2019

we should also test for the case where not all keys are string type

Copy link
Contributor

@rwedge rwedge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@rwedge rwedge merged commit 5f72d96 into alteryx:master Nov 30, 2019
@systemshift systemshift deleted the check_ignore_variable branch November 30, 2019 23:57
@rwedge rwedge mentioned this pull request Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants