]> git.madduck.net Git - etc/vim.git/blob - tests/composition.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:

4e7f606f242604c70dcadc67028714c4a7a8bfe5
[etc/vim.git] / tests / composition.py
1 class C:
2
3     def test(self) -> None:
4         with patch("black.out", print):
5             self.assertEqual(
6                 unstyle(str(report)), "1 file reformatted, 1 file failed to reformat."
7             )
8             self.assertEqual(
9                 unstyle(str(report)),
10                 "1 file reformatted, 1 file left unchanged, 1 file failed to reformat.",
11             )
12             self.assertEqual(
13                 unstyle(str(report)),
14                 "2 files reformatted, 1 file left unchanged, "
15                 "1 file failed to reformat.",
16             )
17             self.assertEqual(
18                 unstyle(str(report)),
19                 "2 files reformatted, 2 files left unchanged, "
20                 "2 files failed to reformat.",
21             )
22             for i in (a,):
23                 if (
24                     # Rule 1
25                     i % 2 == 0
26                     # Rule 2
27                     and i % 3 == 0
28                 ):
29                     while (
30                         # Just a comment
31                         call()
32                         # Another
33                     ):
34                         print(i)
35             if _cfg_target_split > [int(x) for x in cur_target.split(".")]:
36                 my_msg = "$MACOSX_DEPLOYMENT_TARGET mismatch: " 'now "%s" but "%s" during configure' % (
37                     cur_target,
38                     _cfg_target,
39                 )
40
41     def omitting_trailers(self) -> None:
42         get_collection(
43             hey_this_is_a_very_long_call, it_has_funny_attributes, really=True
44         )[OneLevelIndex]
45         get_collection(
46             hey_this_is_a_very_long_call, it_has_funny_attributes, really=True
47         )[OneLevelIndex][TwoLevelIndex][ThreeLevelIndex][FourLevelIndex]
48         d[0][1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][
49             22
50         ]
51
52     def easy_asserts(self) -> None:
53         assert {
54             key1: value1,
55             key2: value2,
56             key3: value3,
57             key4: value4,
58             key5: value5,
59             key6: value6,
60             key7: value7,
61             key8: value8,
62             key9: value9,
63         } == expected, "Not what we expected"
64
65         assert expected == {
66             key1: value1,
67             key2: value2,
68             key3: value3,
69             key4: value4,
70             key5: value5,
71             key6: value6,
72             key7: value7,
73             key8: value8,
74             key9: value9,
75         }, "Not what we expected"
76
77         assert expected == {
78             key1: value1,
79             key2: value2,
80             key3: value3,
81             key4: value4,
82             key5: value5,
83             key6: value6,
84             key7: value7,
85             key8: value8,
86             key9: value9,
87         }
88
89     def tricky_asserts(self) -> None:
90         assert {
91             key1: value1,
92             key2: value2,
93             key3: value3,
94             key4: value4,
95             key5: value5,
96             key6: value6,
97             key7: value7,
98             key8: value8,
99             key9: value9,
100         } == expected(
101             value, is_going_to_be="too long to fit in a single line", srsly=True
102         ), "Not what we expected"
103
104         assert {
105             key1: value1,
106             key2: value2,
107             key3: value3,
108             key4: value4,
109             key5: value5,
110             key6: value6,
111             key7: value7,
112             key8: value8,
113             key9: value9,
114         } == expected, (
115             "Not what we expected and the message is too long to fit in one line"
116         )
117
118         assert expected(
119             value, is_going_to_be="too long to fit in a single line", srsly=True
120         ) == {
121             key1: value1,
122             key2: value2,
123             key3: value3,
124             key4: value4,
125             key5: value5,
126             key6: value6,
127             key7: value7,
128             key8: value8,
129             key9: value9,
130         }, "Not what we expected"
131
132         assert expected == {
133             key1: value1,
134             key2: value2,
135             key3: value3,
136             key4: value4,
137             key5: value5,
138             key6: value6,
139             key7: value7,
140             key8: value8,
141             key9: value9,
142         }, (
143             "Not what we expected and the message is too long to fit "
144             "in one line because it's too long"
145         )
146
147         # This is weird but true.
148         assert expectedexpectedexpectedexpectedexpectedexpectedexpectedexpectedexpect == {
149             key1: value1,
150             key2: value2,
151             key3: value3,
152             key4: value4,
153             key5: value5,
154             key6: value6,
155             key7: value7,
156             key8: value8,
157             key9: value9,
158         }