-
Notifications
You must be signed in to change notification settings - Fork 892
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
Do not match keywords named 'match' #1111
Conversation
Signed-off-by: Kyle Gottfried <[email protected]>
I've verified locally that the diff is clean. :~/Repos/yapf/wt/1110$ curl https://raw.githubusercontent.com/hartwork/wnpp.debian.net/master/wnpp_debian_net/management/commands/importdebbugs.py > importdebbugs.py \
&& curl https://raw.githubusercontent.com/hartwork/wnpp.debian.net/master/.style.yapf > ..style.yapf \
&& pipx run --spec=. yapf --style ..style.yapf --diff importdebbugs.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15430 100 15430 0 0 40814 0 --:--:-- --:--:-- --:--:-- 40820
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 126 100 126 0 0 989 0 --:--:-- --:--:-- --:--:-- 992
⚠️ yapf is already on your PATH and installed at /home/kyle/.local/bin/yapf. Downloading and running anyway.
kyle@mainstay:~/Repos/yapf/wt/1110$ @hartwork , can you write a test for this case? |
@Spitfire1900 did you see hartwork/wnpp.debian.net@0a49666 ? |
I'll try adding it later, @ mentioned yourself because I wasn't going to be available until tomorrow to complete this PR. |
Minimal test case match = (
1,
2,
) Without the fix
|
The sample test added with this commit passes on both tag v0.40.1 and this branch, at this time I am unsure why. The attached file generates the expected output below on v0.40.1 and no output on this branch. pipx run yapf==0.40.1 --no-local-style --diff matchtest.py
⚠️ yapf is already on your PATH and installed at /home/kyle/Repos/yapf/wt/1110/.venv/bin/yapf. Downloading and running anyway.
--- matchtest.py (original)
+++ matchtest.py (reformatted)
@@ -4,11 +4,11 @@
@staticmethod
def _parse_wnpp_issue_subject(subject) -> tuple[str, str, str]:
match = re.match(
- '^(?:[Ss]ubject: )?(?P<kind>[A-Z]{1,3}): ?(?P<package>[^ ]+)(?:(?: --| -| —|:) (?P<description>.*))?$',
- subject)
+ '^(?:[Ss]ubject: )?(?P<kind>[A-Z]{1,3}): ?(?P<package>[^ ]+)(?:(?: --| -| —|:) (?P<description>.*))?$',
+ subject)
match = (
- 1,
- 2,
+ 1,
+ 2,
) |
@bwendling do you have any input on why the manual test referenced in #1111 (comment) performs as expected but the pytest test does not? |
@Spitfire1900 I don't. Just checking. The diff in this comment is wrong and the behavior of |
The diff in that comment is the current behavior of the main branch today, it is not expected. With this PR there is no diff, which is expected. However I am having difficult writing a validation test as the test added to |
Ah! I see. The problem is probably in |
So I was unable to get a test to perform as expected, so I am proposing this PR without a test case. |
@bwendling is it okay if this is merged without new tests? |
Sure! Thanks. :-) |
Closes #1110 , do not match variable names named 'match'.