]> git.madduck.net Git - etc/vim.git/blob - tests/data/cases/preview_prefer_rhs_split.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Fix parser bug where "type" was misinterpreted as a keyword inside a match (#3950)
[etc/vim.git] / tests / data / cases / preview_prefer_rhs_split.py
1 # flags: --preview
2 first_item, second_item = (
3     some_looooooooong_module.some_looooooooooooooong_function_name(
4         first_argument, second_argument, third_argument
5     )
6 )
7
8 some_dict["with_a_long_key"] = (
9     some_looooooooong_module.some_looooooooooooooong_function_name(
10         first_argument, second_argument, third_argument
11     )
12 )
13
14 # Make sure it works when the RHS only has one pair of (optional) parens.
15 first_item, second_item = (
16     some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
17 )
18
19 some_dict["with_a_long_key"] = (
20     some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
21 )
22
23 # Make sure chaining assignments work.
24 first_item, second_item, third_item, forth_item = m["everything"] = (
25     some_looooooooong_module.some_looooooooooooooong_function_name(
26         first_argument, second_argument, third_argument
27     )
28 )
29
30 # Make sure when the RHS's first split at the non-optional paren fits,
31 # we split there instead of the outer RHS optional paren.
32 first_item, second_item = some_looooooooong_module.some_loooooog_function_name(
33     first_argument, second_argument, third_argument
34 )
35
36 (
37     first_item,
38     second_item,
39     third_item,
40     forth_item,
41     fifth_item,
42     last_item_very_loooooong,
43 ) = some_looooooooong_module.some_looooooooooooooong_function_name(
44     first_argument, second_argument, third_argument
45 )
46
47 (
48     first_item,
49     second_item,
50     third_item,
51     forth_item,
52     fifth_item,
53     last_item_very_loooooong,
54 ) = everything = some_looooong_function_name(
55     first_argument, second_argument, third_argument
56 )
57
58
59 # Make sure unsplittable type ignore won't be moved.
60 some_kind_of_table[some_key] = util.some_function(  # type: ignore  # noqa: E501
61     some_arg
62 ).intersection(pk_cols)
63
64 some_kind_of_table[
65     some_key
66 ] = lambda obj: obj.some_long_named_method()  # type: ignore  # noqa: E501
67
68 some_kind_of_table[
69     some_key  # type: ignore  # noqa: E501
70 ] = lambda obj: obj.some_long_named_method()
71
72
73 # Make when when the left side of assignment plus the opening paren "... = (" is
74 # exactly line length limit + 1, it won't be split like that.
75 xxxxxxxxx_yyy_zzzzzzzz[
76     xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
77 ] = 1
78
79
80 # Right side of assignment contains un-nested pairs of inner parens.
81 some_kind_of_instance.some_kind_of_map[a_key] = (
82     isinstance(some_var, SomeClass)
83     and table.something_and_something != table.something_else
84 ) or (
85     isinstance(some_other_var, BaseClass) and table.something != table.some_other_thing
86 )