Skip to content

Commit 10d4790

Browse files
authored
style: split expected-payload attributes in blocks tests (#231)
1 parent 3996ddf commit 10d4790

4 files changed

Lines changed: 89 additions & 43 deletions

File tree

‎block-kit/tests/blocks/test_plan.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def test_example01():
2525
{
2626
"type": "text",
2727
"text": "Searched database...",
28-
}
28+
},
2929
],
30-
}
30+
},
3131
],
3232
},
3333
"output": {
@@ -40,9 +40,9 @@ def test_example01():
4040
{
4141
"type": "text",
4242
"text": "Profile data loaded",
43-
}
43+
},
4444
],
45-
}
45+
},
4646
],
4747
},
4848
},
@@ -67,9 +67,9 @@ def test_example01():
6767
{
6868
"type": "text",
6969
"text": "15 data points compiled",
70-
}
70+
},
7171
],
72-
}
72+
},
7373
],
7474
},
7575
},

‎block-kit/tests/blocks/test_rich_text.py‎

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def test_example01():
1616
{
1717
"type": "text",
1818
"text": "Hello there, I am a basic rich text block!",
19-
}
19+
},
2020
],
21-
}
21+
},
2222
],
2323
},
2424
{
@@ -39,7 +39,7 @@ def test_example01():
3939
},
4040
},
4141
],
42-
}
42+
},
4343
],
4444
},
4545
{
@@ -60,7 +60,7 @@ def test_example01():
6060
},
6161
},
6262
],
63-
}
63+
},
6464
],
6565
},
6666
{
@@ -81,7 +81,7 @@ def test_example01():
8181
},
8282
},
8383
],
84-
}
84+
},
8585
],
8686
},
8787
]
@@ -101,7 +101,7 @@ def test_example02():
101101
{
102102
"type": "text",
103103
"text": "My favorite Slack features (in no particular order):",
104-
}
104+
},
105105
],
106106
},
107107
{
@@ -221,7 +221,7 @@ def test_example03():
221221
"text": "Pancakes, extra syrup",
222222
},
223223
],
224-
}
224+
},
225225
],
226226
},
227227
],
@@ -241,10 +241,10 @@ def test_example04():
241241
{
242242
"type": "text",
243243
"text": '{\n "object": {\n "description": "this is an example of a json object"\n }\n}',
244-
}
244+
},
245245
],
246246
"border": 0,
247-
}
247+
},
248248
],
249249
}
250250
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)
@@ -263,7 +263,7 @@ def test_example05():
263263
{
264264
"type": "text",
265265
"text": "What we need is good examples in our documentation.",
266-
}
266+
},
267267
],
268268
},
269269
{
@@ -288,8 +288,13 @@ def test_example06():
288288
"elements": [
289289
{
290290
"type": "rich_text_section",
291-
"elements": [{"type": "broadcast", "range": "everyone"}],
292-
}
291+
"elements": [
292+
{
293+
"type": "broadcast",
294+
"range": "everyone",
295+
},
296+
],
297+
},
293298
],
294299
}
295300
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)
@@ -303,8 +308,13 @@ def test_example07():
303308
"elements": [
304309
{
305310
"type": "rich_text_section",
306-
"elements": [{"type": "color", "value": "#F405B3"}],
307-
}
311+
"elements": [
312+
{
313+
"type": "color",
314+
"value": "#F405B3",
315+
},
316+
],
317+
},
308318
],
309319
}
310320
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)
@@ -318,8 +328,13 @@ def test_example08():
318328
"elements": [
319329
{
320330
"type": "rich_text_section",
321-
"elements": [{"type": "channel", "channel_id": "C123ABC456"}],
322-
}
331+
"elements": [
332+
{
333+
"type": "channel",
334+
"channel_id": "C123ABC456",
335+
},
336+
],
337+
},
323338
],
324339
}
325340
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)
@@ -339,9 +354,9 @@ def test_example09():
339354
"timestamp": 1720710212,
340355
"format": "{date_num} at {time}",
341356
"fallback": "timey",
342-
}
357+
},
343358
],
344-
}
359+
},
345360
],
346361
}
347362
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)
@@ -377,7 +392,7 @@ def test_example10():
377392
"name": "checkered_flag",
378393
},
379394
],
380-
}
395+
},
381396
],
382397
}
383398
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)
@@ -391,8 +406,13 @@ def test_example11():
391406
"elements": [
392407
{
393408
"type": "rich_text_section",
394-
"elements": [{"type": "link", "url": "https://api.slack.com"}],
395-
}
409+
"elements": [
410+
{
411+
"type": "link",
412+
"url": "https://api.slack.com",
413+
},
414+
],
415+
},
396416
],
397417
}
398418
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)
@@ -406,8 +426,13 @@ def test_example12():
406426
"elements": [
407427
{
408428
"type": "rich_text_section",
409-
"elements": [{"type": "user", "user_id": "U123ABC456"}],
410-
}
429+
"elements": [
430+
{
431+
"type": "user",
432+
"user_id": "U123ABC456",
433+
},
434+
],
435+
},
411436
],
412437
}
413438
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)
@@ -421,8 +446,13 @@ def test_example13():
421446
"elements": [
422447
{
423448
"type": "rich_text_section",
424-
"elements": [{"type": "usergroup", "usergroup_id": "G123ABC456"}],
425-
}
449+
"elements": [
450+
{
451+
"type": "usergroup",
452+
"usergroup_id": "G123ABC456",
453+
},
454+
],
455+
},
426456
],
427457
}
428458
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)

‎block-kit/tests/blocks/test_table.py‎

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,29 @@ def test_example01():
99
expected = {
1010
"type": "table",
1111
"column_settings": [
12-
{"is_wrapped": True},
13-
{"align": "right"},
12+
{
13+
"is_wrapped": True,
14+
},
15+
{
16+
"align": "right",
17+
},
1418
],
1519
"rows": [
1620
[
17-
{"type": "raw_text", "text": "Header A"},
18-
{"type": "raw_text", "text": "Header B"},
21+
{
22+
"type": "raw_text",
23+
"text": "Header A",
24+
},
25+
{
26+
"type": "raw_text",
27+
"text": "Header B",
28+
},
1929
],
2030
[
21-
{"type": "raw_text", "text": "Data 1A"},
31+
{
32+
"type": "raw_text",
33+
"text": "Data 1A",
34+
},
2235
{
2336
"type": "rich_text",
2437
"elements": [
@@ -29,14 +42,17 @@ def test_example01():
2942
"type": "link",
3043
"text": "Data 1B",
3144
"url": "https://slack.com",
32-
}
45+
},
3346
],
34-
}
47+
},
3548
],
3649
},
3750
],
3851
[
39-
{"type": "raw_text", "text": "Data 2A"},
52+
{
53+
"type": "raw_text",
54+
"text": "Data 2A",
55+
},
4056
{
4157
"type": "rich_text",
4258
"elements": [
@@ -47,9 +63,9 @@ def test_example01():
4763
"type": "link",
4864
"text": "Data 2B",
4965
"url": "https://slack.com",
50-
}
66+
},
5167
],
52-
}
68+
},
5369
],
5470
},
5571
],

‎block-kit/tests/blocks/test_task_card.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ def test_example01():
2020
{
2121
"type": "text",
2222
"text": "Found weather data for Chicago from 2 sources",
23-
}
23+
},
2424
],
25-
}
25+
},
2626
],
2727
},
2828
"sources": [

0 commit comments

Comments
 (0)