-
Notifications
You must be signed in to change notification settings - Fork 751
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
Make tested code valid Python code #657
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
#: E111 | ||
if x > 2: | ||
print x | ||
print(x) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This means we'll loose coverage for the print statement then, yes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure I fully understand what you mean. The E11 errors does not seem to be related to print and/or parentheses in any way. |
||
#: E111 | ||
if True: | ||
#: E112 | ||
# Potential E901 | ||
if False: | ||
#: E113 | ||
# Potential E901 | ||
#: E114 E116 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
#: E121 | ||
print "E121", ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same concern as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If parentheses are important for these tests (which is likely), maybe I could replace the
with
or
|
||
"dent") | ||
print("E121", ( | ||
"dent")) | ||
#: E122 | ||
print "E122", ( | ||
"dent") | ||
print("E122", ( | ||
"dent")) | ||
#: E123 | ||
my_list = [ | ||
1, 2, 3, | ||
4, 5, 6, | ||
] | ||
#: E124 | ||
print "E124", ("visual", | ||
print("E124", ("visual", | ||
"indent_two" | ||
) | ||
)) | ||
#: E124 | ||
print "E124", ("visual", | ||
print("E124", ("visual", | ||
"indent_five" | ||
) | ||
)) | ||
#: E124 | ||
a = (123, | ||
) | ||
|
@@ -25,20 +25,20 @@ | |
col < 0 or self.moduleCount <= col): | ||
raise Exception("%s,%s - %s" % (row, col, self.moduleCount)) | ||
#: E126 | ||
print "E126", ( | ||
"dent") | ||
print("E126", ( | ||
"dent")) | ||
#: E126 | ||
print "E126", ( | ||
"dent") | ||
print("E126", ( | ||
"dent")) | ||
#: E127 | ||
print "E127", ("over-", | ||
"over-indent") | ||
print("E127", ("over-", | ||
"over-indent")) | ||
#: E128 | ||
print "E128", ("visual", | ||
"hanging") | ||
print("E128", ("visual", | ||
"hanging")) | ||
#: E128 | ||
print "E128", ("under-", | ||
"under-indent") | ||
print("E128", ("under-", | ||
"under-indent")) | ||
#: | ||
|
||
|
||
|
@@ -63,11 +63,11 @@ | |
4 + \ | ||
5 + 6 | ||
#: E131 | ||
print "hello", ( | ||
print("hello", ( | ||
|
||
"there", | ||
# "john", | ||
"dude") | ||
"dude")) | ||
#: E126 | ||
part = set_mimetype(( | ||
a.get('mime_type', 'text')), | ||
|
@@ -100,11 +100,11 @@ | |
or another_very_long_variable_name: | ||
raise Exception() | ||
#: E122 | ||
dictionary = [ | ||
dictionary = { | ||
"is": { | ||
"nested": yes(), | ||
}, | ||
] | ||
} | ||
#: E122 | ||
setup('', | ||
scripts=[''], | ||
|
@@ -117,9 +117,9 @@ | |
|
||
|
||
#: E123 W291 | ||
print "E123", ( | ||
print("E123", ( | ||
"bad", "hanging", "close" | ||
) | ||
)) | ||
# | ||
#: E123 E123 E123 | ||
result = { | ||
|
@@ -358,15 +358,15 @@ def example_issue254(): | |
""".strip().split(): | ||
print(foo) | ||
#: E122:6:5 E122:7:5 E122:8:1 | ||
print dedent( | ||
print(dedent( | ||
''' | ||
mkdir -p ./{build}/ | ||
mv ./build/ ./{build}/%(revision)s/ | ||
'''.format( | ||
build='build', | ||
# more stuff | ||
) | ||
) | ||
)) | ||
#: E701:1:8 E122:2:1 E203:4:8 E128:5:1 | ||
if True:\ | ||
print(True) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
True and False | ||
#: E271 | ||
if 1: | ||
pass | ||
#: E273 | ||
True and False | ||
#: E273 E274 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were two separate checks for two separate test cases. Collapsing them may introduce bugs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole thing is still tested, isn't it ? Or I can write:
and
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather retain two separate tests cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am suggesting 2 separate test cases, each of them corresponding to a piece of valid Python code.