spacing in py3 annotations (PY-8961)

This commit is contained in:
Dmitry Jemerov
2013-02-27 14:11:14 +01:00
parent 59ef18383b
commit f64ae0c21b
4 changed files with 13 additions and 0 deletions
@@ -84,6 +84,7 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
.afterInside(GT, ANNOTATION).spaces(1)
.betweenInside(MINUS, GT, ANNOTATION).none()
.beforeInside(ANNOTATION, FUNCTION_DECLARATION).spaces(1)
.beforeInside(ANNOTATION, NAMED_PARAMETER).none()
.between(allButLambda(), PARAMETER_LIST).spaceIf(commonSettings.SPACE_BEFORE_METHOD_PARENTHESES)
@@ -0,0 +1,2 @@
def foo(x : int):
pass
@@ -0,0 +1,2 @@
def foo(x: int):
pass
@@ -66,6 +66,10 @@ public class PyFormatterTest extends PyTestCase {
}
public void testStarExpression() { // PY-1523
doTestPy3();
}
private void doTestPy3() {
PythonLanguageLevelPusher.setForcedLanguageLevel(myFixture.getProject(), LanguageLevel.PYTHON30);
try {
doTest();
@@ -304,6 +308,10 @@ public class PyFormatterTest extends PyTestCase {
}
}
public void testSpaceInAnnotations() { // PY-8961
doTestPy3();
}
private void doTest() {
myFixture.configureByFile("formatter/" + getTestName(true) + ".py");
ApplicationManager.getApplication().runWriteAction(new Runnable() {