Don't force a split in Google style.
Google / Chromium allows you to put a set generator on a single line if it's
trivial and fits.
diff --git a/yapf/yapflib/style.py b/yapf/yapflib/style.py
index 7fd2177..6f14fad 100644
--- a/yapf/yapflib/style.py
+++ b/yapf/yapflib/style.py
@@ -312,8 +312,9 @@
style['I18N_COMMENT'] = r'#\..*'
style['I18N_FUNCTION_CALL'] = ['N_', '_']
style['SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET'] = False
- style['SPLIT_BEFORE_LOGICAL_OPERATOR'] = False
style['SPLIT_BEFORE_BITWISE_OPERATOR'] = False
+ style['SPLIT_BEFORE_DICT_SET_GENERATOR'] = False
+ style['SPLIT_BEFORE_LOGICAL_OPERATOR'] = False
style['SPLIT_COMPLEX_COMPREHENSION'] = True
style['SPLIT_PENALTY_COMPREHENSION'] = 2100
return style
diff --git a/yapftests/reformatter_buganizer_test.py b/yapftests/reformatter_buganizer_test.py
index e04c962..9d6a49d 100644
--- a/yapftests/reformatter_buganizer_test.py
+++ b/yapftests/reformatter_buganizer_test.py
@@ -28,6 +28,26 @@
def setUpClass(cls):
style.SetGlobalStyle(style.CreateChromiumStyle())
+ def testB65246454(self):
+ unformatted_code = """\
+class _():
+
+ def _(self):
+ self.assertEqual({i.id
+ for i in successful_instances},
+ {i.id
+ for i in self._statuses.successful_instances})
+"""
+ expected_formatted_code = """\
+class _():
+
+ def _(self):
+ self.assertEqual({i.id for i in successful_instances},
+ {i.id for i in self._statuses.successful_instances})
+"""
+ uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code)
+ self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines))
+
def testB67935450(self):
unformatted_code = """\
def _():