This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
58 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"""Test for warning about f-strings as docstrings.""" | ||
|
||
from .expected import Expectation | ||
|
||
expectation = Expectation() | ||
expect = expectation.expect | ||
_GIZMO = "gizmo" | ||
D303 = expect("D303: f-strings are not valid as docstrings") | ||
|
||
|
||
@D303 | ||
def fstring(): | ||
f"""Toggle the gizmo.""" | ||
|
||
|
||
@D303 | ||
def another_fstring(): | ||
F"""Toggle the gizmo.""" | ||
|
||
|
||
@D303 | ||
def fstring_with_raw(): | ||
rF"""Toggle the gizmo.""" | ||
|
||
|
||
@D303 | ||
def fstring_with_raw_caps(): | ||
RF"""Toggle the gizmo.""" | ||
|
||
|
||
@D303 | ||
def fstring_with_raw_variable(): | ||
RF"""Toggle the {_GIZMO}.""" | ||
|
||
|
||
@D303 | ||
def fstring_with_variable(): | ||
f"""Toggle the {_GIZMO.upper()}.""" | ||
|
||
|
||
@D303 | ||
def fstring_with_other_errors(arg=1, missing_arg=2): | ||
f"""Toggle the {_GIZMO.upper()} | ||
This should not raise any other errors since fstrings | ||
are a terminal check. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters