PY-11552 Keep maximum 1 empty line between declarations and in code by default

Fix affected test data where reformat is invoked during refactoring.
Also use entire sample provided by user in the corresponding test case
for the issue.
This commit is contained in:
Mikhail Golubev
2015-04-27 20:34:47 +03:00
parent 12c537a639
commit 32b76de893
11 changed files with 28 additions and 9 deletions
@@ -116,6 +116,8 @@ public class PyLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettin
CommonCodeStyleSettings.IndentOptions indentOptions = defaultSettings.initIndentOptions();
indentOptions.INDENT_SIZE = 4;
defaultSettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
defaultSettings.KEEP_BLANK_LINES_IN_DECLARATIONS = 1;
defaultSettings.KEEP_BLANK_LINES_IN_CODE = 1;
return defaultSettings;
}
@@ -1,9 +1,26 @@
class Foo(object):
def wrong_blank_lines(self):
pass
def next_method(self):
pass
@@ -11,3 +28,10 @@ class Foo(object):
@@ -2,6 +2,5 @@ class Foo(object):
def wrong_blank_lines(self):
pass
def next_method(self):
pass
@@ -5,7 +5,6 @@ import datetime
import foo
from bar import *
sys.path
datetime.datetime
foo.bar()
@@ -5,7 +5,6 @@ import datetime
import foo
from bar import *
sys.path
datetime.datetime
foo.bar()
@@ -1,7 +1,6 @@
from a import main
from b import C
if __name__ == '__main__':
main()
c = C()
@@ -1,6 +1,5 @@
from file1 import function_2
from file2 import function_1
function_1()
function_2()
@@ -1,6 +1,5 @@
from file1 import function_1
from file2 import function_2
function_1()
function_2()
@@ -7,7 +7,6 @@ class AnyClass(SuperClass):
def __init__(self):
super(AnyClass, self).__init__()
def foo(self):
pass
@@ -11,7 +11,6 @@ class Parent(object):
def __init__(self):
pass
def method_2(self):
i = 1
@@ -537,7 +537,8 @@ public class PyFormatterTest extends PyTestCase {
}
// PY-11552
public void testDeleteTrailingBlankLines() {
public void testExtraBlankLinesBetweenMethodsAndAtTheEnd() {
getCommonSettings().KEEP_BLANK_LINES_IN_DECLARATIONS = 1;
doTest();
}