-
Notifications
You must be signed in to change notification settings - Fork 581
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
YapfBear: Disable syntax verification #748
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,4 +1,6 @@ | ||
import sys | ||
from queue import Queue | ||
from unittest.case import skipIf | ||
|
||
from bears.python.YapfBear import YapfBear | ||
from tests.LocalBearTestHelper import LocalBearTestHelper | ||
|
@@ -22,6 +24,15 @@ def test_valid(self): | |
["x = { 'a':37,'b':42,\n", "'c':927}\n", '\n', | ||
"y = 'hello ''world'\n"], valid=False) | ||
|
||
def test_valid_python_2(self): | ||
self.check_validity(self.uut, ['print 1\n'], valid=True) | ||
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. How come this works ? 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. @AbdealiJK I think it's because of this special handling of the old print syntax in python 3:
If Python 3 is able to recognize that the syntax is old, then the 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. Hm, interesting - alright |
||
|
||
@skipIf(sys.version_info < (3, 5), "ast before 3.5 can't parse async def") | ||
def test_valid_async(self): | ||
self.check_validity(self.uut, | ||
['async def x():\n', ' pass\n'], | ||
valid=True) | ||
|
||
def test_blank_line_after_nested_class_or_def(self): | ||
self.section.append(Setting('blank_line_before_nested_class_or_def', | ||
True)) | ||
|
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.
If this was a bug, and a major one - shouldn't there be a test case to avoid regression ?
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.
👍 on it