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

Fix string formatting in "dummy handlers" #2361

Merged
merged 4 commits into from
Apr 15, 2022

Conversation

lvalerom
Copy link
Member

Some of the strings in the "dummy handlers" were not properly formatted, as seen below:

# Notice that the parenthesis here are incorrect
ValueError("Method '{}' is not invoked. (Invoked method \
           is '{}'.)").format(method, self._invokedMethod)

As discussed here this PR fixes the string formatting of these modules and changes said formatting to f-strings:

ValueError(f"Method '{method}' is not invoked. (Invoked method "
           f"is '{self._invokedMethod}').")

@codecov
Copy link

codecov bot commented Apr 15, 2022

Codecov Report

Merging #2361 (80883cf) into main (82136f4) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #2361   +/-   ##
=======================================
  Coverage   63.17%   63.17%           
=======================================
  Files         132      132           
  Lines       17187    17187           
=======================================
  Hits        10858    10858           
  Misses       6329     6329           

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

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

I think we don't need the return values, otherwise it look all very nice.

(str(key), method_name))
return False
raise ValueError(f"Parameter '{key}' not found in method '{method_name}'")
return True
Copy link
Member

Choose a reason for hiding this comment

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

Does this return value have any effect? As far as I see there are no asserts for the tests, so unless an exception is raised anywhere the tests using check_call would pass.

Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed that as well but I left them just in case. But since you brought it up I'll remove them. I double checked the code and they're never called expecting them to return anything.

@lvalerom lvalerom force-pushed the fix-string-formatting-in-dummy-handler branch from fba1021 to f7230b9 Compare April 15, 2022 21:00
@bsipocz bsipocz merged commit 1368992 into astropy:main Apr 15, 2022
@bsipocz
Copy link
Member

bsipocz commented Apr 15, 2022

Thanks @lvalerom!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants