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

Unit test for parameter interpolation failure #105

Merged
merged 3 commits into from
Dec 11, 2019

Conversation

gabbard
Copy link

@gabbard gabbard commented Dec 10, 2019

No description provided.

@codecov
Copy link

codecov bot commented Dec 10, 2019

Codecov Report

Merging #105 into master will increase coverage by 0.16%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #105      +/-   ##
==========================================
+ Coverage   78.58%   78.75%   +0.16%     
==========================================
  Files          24       24              
  Lines        2358     2358              
==========================================
+ Hits         1853     1857       +4     
+ Misses        505      501       -4
Impacted Files Coverage Δ
vistautils/parameters.py 79.87% <100%> (+0.82%) ⬆️

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 34cdad8...ea54110. Read the comment docs.

@@ -1216,7 +1216,7 @@ def _check_all_keys_strings(mapping: Mapping, path=None):
if isinstance(val, Mapping):
YAMLParametersLoader._check_all_keys_strings(val)

_INTERPOLATION_REGEX = re.compile(r"%([\w\.]+)%")
_INTERPOLATION_REGEX = re.compile(r"%([\w.\-_]+)%")
Copy link
Member

Choose a reason for hiding this comment

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

If I check out this PR but then revert the regex change, this still passes. Underscore should be covered by \w, so that leaves \w\. versus \w.\-. Here are my tests:

In [17]: test_str = "foo-bar_baz.meep"

In [18]: re.findall(r"[\w\.]+", test_str)
Out[18]: ['foo', 'bar_baz.meep']

In [19]: re.findall(r"[\w.\-]+", test_str)
Out[19]: ['foo-bar_baz.meep']

In [20]: re.findall(r"[\w\-]+", test_str)
Out[20]: ['foo-bar_baz', 'meep']

We should have a test for this if we don't already.

Copy link
Author

Choose a reason for hiding this comment

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

Addressed in ea54110

@berquist
Copy link
Member

I've confirmed that this effectively tests the current regex and breaks when reverting to the old one.

@gabbard gabbard merged commit ffc5f98 into master Dec 11, 2019
@gabbard gabbard deleted the test-for-interpolation-error branch December 11, 2019 21:38
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.

2 participants