mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
PY-21515 Always put a single space after "from" keyword
This commit is contained in:
@@ -121,7 +121,7 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
|
||||
.beforeInside(RPAR, FROM_IMPORT_STATEMENT).spaces(0, pySettings.FROM_IMPORT_NEW_LINE_BEFORE_RIGHT_PARENTHESIS)
|
||||
.after(COMMA).spaceIf(commonSettings.SPACE_AFTER_COMMA)
|
||||
.before(COMMA).spaceIf(commonSettings.SPACE_BEFORE_COMMA)
|
||||
.between(FROM_KEYWORD, DOT).spaces(1)
|
||||
.after(FROM_KEYWORD).spaces(1)
|
||||
.between(DOT, IMPORT_KEYWORD).spaces(1)
|
||||
.around(DOT).spaces(0)
|
||||
.aroundInside(AT, DECORATOR_CALL).none()
|
||||
|
||||
6
python/testData/formatter/spacesAfterFromInYieldFrom.py
Normal file
6
python/testData/formatter/spacesAfterFromInYieldFrom.py
Normal file
@@ -0,0 +1,6 @@
|
||||
def g():
|
||||
yield 42
|
||||
|
||||
|
||||
def f():
|
||||
yield from g()
|
||||
@@ -0,0 +1,6 @@
|
||||
def g():
|
||||
yield 42
|
||||
|
||||
|
||||
def f():
|
||||
yield from g()
|
||||
@@ -0,0 +1,3 @@
|
||||
from sys import path
|
||||
|
||||
print(sys.path)
|
||||
@@ -0,0 +1,3 @@
|
||||
from sys import path
|
||||
|
||||
print(sys.path)
|
||||
@@ -809,6 +809,15 @@ public class PyFormatterTest extends PyTestCase {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest);
|
||||
}
|
||||
|
||||
// PY-21515
|
||||
public void testSpacesBeforeFromImportSource() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSpacesAfterFromInYieldFrom() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON33, this::doTest);
|
||||
}
|
||||
|
||||
public void testVariableAnnotations() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user