python-liquid 2.0.0__py3-none-any.whl → 2.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- liquid/__init__.py +1 -1
- liquid/builtin/expressions/loop.py +2 -5
- liquid/builtin/loaders/mixins.py +1 -2
- liquid/extra/tags/macro_tag.py +2 -0
- liquid/messages.py +1 -1
- liquid/static_analysis.py +16 -10
- {python_liquid-2.0.0.dist-info → python_liquid-2.0.2.dist-info}/METADATA +6 -9
- python_liquid-2.0.2.dist-info/RECORD +95 -0
- liquid/golden/__init__.py +0 -173
- liquid/golden/abs_filter.py +0 -73
- liquid/golden/append_filter.py +0 -43
- liquid/golden/assign_tag.py +0 -45
- liquid/golden/at_least_filter.py +0 -78
- liquid/golden/at_most_filter.py +0 -68
- liquid/golden/base64_decode_filter.py +0 -43
- liquid/golden/base64_encode_filter.py +0 -42
- liquid/golden/base64_url_safe_decode_filter.py +0 -43
- liquid/golden/base64_url_safe_encode_filter.py +0 -42
- liquid/golden/capitalize_filter.py +0 -27
- liquid/golden/capture_tag.py +0 -39
- liquid/golden/case.py +0 -28
- liquid/golden/case_tag.py +0 -226
- liquid/golden/ceil_filter.py +0 -63
- liquid/golden/comment_tag.py +0 -119
- liquid/golden/compact_filter.py +0 -54
- liquid/golden/concat_filter.py +0 -63
- liquid/golden/cycle_tag.py +0 -114
- liquid/golden/date_filter.py +0 -63
- liquid/golden/decrement_tag.py +0 -16
- liquid/golden/default_filter.py +0 -112
- liquid/golden/divided_by_filter.py +0 -101
- liquid/golden/doc_tag.py +0 -61
- liquid/golden/downcase_filter.py +0 -27
- liquid/golden/echo_tag.py +0 -116
- liquid/golden/escape_filter.py +0 -27
- liquid/golden/escape_once_filter.py +0 -32
- liquid/golden/find_filter.py +0 -90
- liquid/golden/find_index_filter.py +0 -96
- liquid/golden/first_filter.py +0 -51
- liquid/golden/floor_filter.py +0 -63
- liquid/golden/for_tag.py +0 -642
- liquid/golden/has_filter.py +0 -139
- liquid/golden/identifiers.py +0 -249
- liquid/golden/if_tag.py +0 -531
- liquid/golden/ifchanged_tag.py +0 -46
- liquid/golden/illegal.py +0 -34
- liquid/golden/include_tag.py +0 -196
- liquid/golden/increment_tag.py +0 -48
- liquid/golden/inline_comment_tag.py +0 -127
- liquid/golden/join_filter.py +0 -69
- liquid/golden/last_filter.py +0 -51
- liquid/golden/liquid_tag.py +0 -215
- liquid/golden/lstrip_filter.py +0 -37
- liquid/golden/map_filter.py +0 -50
- liquid/golden/minus_filter.py +0 -58
- liquid/golden/modulo_filter.py +0 -60
- liquid/golden/newline_to_br_filter.py +0 -37
- liquid/golden/not_liquid.py +0 -16
- liquid/golden/output_statement.py +0 -295
- liquid/golden/plus_filter.py +0 -63
- liquid/golden/prepend_filter.py +0 -43
- liquid/golden/range_objects.py +0 -79
- liquid/golden/raw_tag.py +0 -31
- liquid/golden/reject_filter.py +0 -268
- liquid/golden/remove_filter.py +0 -45
- liquid/golden/remove_first_filter.py +0 -46
- liquid/golden/remove_last_filter.py +0 -46
- liquid/golden/render_tag.py +0 -210
- liquid/golden/replace_filter.py +0 -65
- liquid/golden/replace_first_filter.py +0 -59
- liquid/golden/replace_last_filter.py +0 -60
- liquid/golden/reverse_filter.py +0 -42
- liquid/golden/round_filter.py +0 -87
- liquid/golden/rstrip_filter.py +0 -37
- liquid/golden/size_filter.py +0 -42
- liquid/golden/slice_filter.py +0 -119
- liquid/golden/sort_filter.py +0 -86
- liquid/golden/sort_natural_filter.py +0 -105
- liquid/golden/special.py +0 -91
- liquid/golden/split_filter.py +0 -128
- liquid/golden/strip_filter.py +0 -37
- liquid/golden/strip_html_filter.py +0 -74
- liquid/golden/strip_newlines_filter.py +0 -37
- liquid/golden/sum_filter.py +0 -97
- liquid/golden/tablerow_tag.py +0 -399
- liquid/golden/times_filter.py +0 -53
- liquid/golden/truncate_filter.py +0 -61
- liquid/golden/truncatewords_filter.py +0 -94
- liquid/golden/uniq_filter.py +0 -87
- liquid/golden/unless_tag.py +0 -101
- liquid/golden/upcase_filter.py +0 -27
- liquid/golden/url_decode_filter.py +0 -27
- liquid/golden/url_encode_filter.py +0 -27
- liquid/golden/where_filter.py +0 -122
- liquid/golden/whitespace_control.py +0 -281
- python_liquid-2.0.0.dist-info/RECORD +0 -182
- {python_liquid-2.0.0.dist-info → python_liquid-2.0.2.dist-info}/WHEEL +0 -0
- {python_liquid-2.0.0.dist-info → python_liquid-2.0.2.dist-info}/licenses/LICENSE +0 -0
liquid/golden/tablerow_tag.py
DELETED
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's `tablerow` tag."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="one row",
|
|
8
|
-
template=r"{% tablerow tag in collection.tags %}{{ tag }}{% endtablerow %}",
|
|
9
|
-
expect=(
|
|
10
|
-
'<tr class="row1">\n'
|
|
11
|
-
'<td class="col1">tag1</td>'
|
|
12
|
-
'<td class="col2">tag2</td>'
|
|
13
|
-
'<td class="col3">tag3</td>'
|
|
14
|
-
'<td class="col4">tag4</td>'
|
|
15
|
-
"</tr>\n"
|
|
16
|
-
),
|
|
17
|
-
globals={
|
|
18
|
-
"collection": {
|
|
19
|
-
"tags": [
|
|
20
|
-
"tag1",
|
|
21
|
-
"tag2",
|
|
22
|
-
"tag3",
|
|
23
|
-
"tag4",
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
),
|
|
28
|
-
Case(
|
|
29
|
-
description="one row with limit",
|
|
30
|
-
template=(
|
|
31
|
-
r"{% tablerow tag in collection.tags limit: 2 %}"
|
|
32
|
-
r"{{ tag }}"
|
|
33
|
-
r"{% endtablerow %}"
|
|
34
|
-
),
|
|
35
|
-
expect=(
|
|
36
|
-
'<tr class="row1">\n'
|
|
37
|
-
'<td class="col1">tag1</td>'
|
|
38
|
-
'<td class="col2">tag2</td>'
|
|
39
|
-
"</tr>\n"
|
|
40
|
-
),
|
|
41
|
-
globals={
|
|
42
|
-
"collection": {
|
|
43
|
-
"tags": [
|
|
44
|
-
"tag1",
|
|
45
|
-
"tag2",
|
|
46
|
-
"tag3",
|
|
47
|
-
"tag4",
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
),
|
|
52
|
-
Case(
|
|
53
|
-
description="one row with offset",
|
|
54
|
-
template=(
|
|
55
|
-
r"{% tablerow tag in collection.tags offset: 2 %}"
|
|
56
|
-
r"{{ tag }}"
|
|
57
|
-
r"{% endtablerow %}"
|
|
58
|
-
),
|
|
59
|
-
expect=(
|
|
60
|
-
'<tr class="row1">\n'
|
|
61
|
-
'<td class="col1">tag3</td>'
|
|
62
|
-
'<td class="col2">tag4</td>'
|
|
63
|
-
"</tr>\n"
|
|
64
|
-
),
|
|
65
|
-
globals={
|
|
66
|
-
"collection": {
|
|
67
|
-
"tags": [
|
|
68
|
-
"tag1",
|
|
69
|
-
"tag2",
|
|
70
|
-
"tag3",
|
|
71
|
-
"tag4",
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
),
|
|
76
|
-
Case(
|
|
77
|
-
description="two columns",
|
|
78
|
-
template=(
|
|
79
|
-
r"{% tablerow tag in collection.tags cols:2 %}"
|
|
80
|
-
r"{{ tag }}"
|
|
81
|
-
r"{% endtablerow %}"
|
|
82
|
-
),
|
|
83
|
-
expect=(
|
|
84
|
-
'<tr class="row1">\n'
|
|
85
|
-
'<td class="col1">tag1</td>'
|
|
86
|
-
'<td class="col2">tag2</td>'
|
|
87
|
-
"</tr>\n"
|
|
88
|
-
'<tr class="row2">'
|
|
89
|
-
'<td class="col1">tag3</td>'
|
|
90
|
-
'<td class="col2">tag4</td>'
|
|
91
|
-
"</tr>\n"
|
|
92
|
-
),
|
|
93
|
-
globals={
|
|
94
|
-
"collection": {
|
|
95
|
-
"tags": [
|
|
96
|
-
"tag1",
|
|
97
|
-
"tag2",
|
|
98
|
-
"tag3",
|
|
99
|
-
"tag4",
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
),
|
|
104
|
-
Case(
|
|
105
|
-
description="two column range",
|
|
106
|
-
template=(
|
|
107
|
-
r"{% tablerow i in (1..4) cols:2 %}"
|
|
108
|
-
r"{{ i }} {{ tablerowloop.col_first }}"
|
|
109
|
-
r"{% endtablerow %}"
|
|
110
|
-
),
|
|
111
|
-
expect=(
|
|
112
|
-
'<tr class="row1">\n'
|
|
113
|
-
'<td class="col1">1 true</td>'
|
|
114
|
-
'<td class="col2">2 false</td>'
|
|
115
|
-
"</tr>\n"
|
|
116
|
-
'<tr class="row2">'
|
|
117
|
-
'<td class="col1">3 true</td>'
|
|
118
|
-
'<td class="col2">4 false</td>'
|
|
119
|
-
"</tr>\n"
|
|
120
|
-
),
|
|
121
|
-
),
|
|
122
|
-
Case(
|
|
123
|
-
description="two column odd range",
|
|
124
|
-
template=(
|
|
125
|
-
r"{% tablerow i in (1..5) cols:2 %}"
|
|
126
|
-
r"{{ i }} {{ tablerowloop.col_first }}"
|
|
127
|
-
r"{% endtablerow %}"
|
|
128
|
-
),
|
|
129
|
-
expect=(
|
|
130
|
-
'<tr class="row1">\n'
|
|
131
|
-
'<td class="col1">1 true</td>'
|
|
132
|
-
'<td class="col2">2 false</td>'
|
|
133
|
-
"</tr>\n"
|
|
134
|
-
'<tr class="row2">'
|
|
135
|
-
'<td class="col1">3 true</td>'
|
|
136
|
-
'<td class="col2">4 false</td>'
|
|
137
|
-
"</tr>\n"
|
|
138
|
-
'<tr class="row3">'
|
|
139
|
-
'<td class="col1">5 true</td>'
|
|
140
|
-
"</tr>\n"
|
|
141
|
-
),
|
|
142
|
-
),
|
|
143
|
-
Case(
|
|
144
|
-
description="two column odd range row numbers",
|
|
145
|
-
template=(
|
|
146
|
-
r"{% tablerow i in (1..5) cols:2 %}"
|
|
147
|
-
r"{{ i }} {{ tablerowloop.row }}"
|
|
148
|
-
r"{% endtablerow %}"
|
|
149
|
-
),
|
|
150
|
-
expect=(
|
|
151
|
-
'<tr class="row1">\n'
|
|
152
|
-
'<td class="col1">1 1</td>'
|
|
153
|
-
'<td class="col2">2 1</td>'
|
|
154
|
-
"</tr>\n"
|
|
155
|
-
'<tr class="row2">'
|
|
156
|
-
'<td class="col1">3 2</td>'
|
|
157
|
-
'<td class="col2">4 2</td>'
|
|
158
|
-
"</tr>\n"
|
|
159
|
-
'<tr class="row3">'
|
|
160
|
-
'<td class="col1">5 3</td>'
|
|
161
|
-
"</tr>\n"
|
|
162
|
-
),
|
|
163
|
-
),
|
|
164
|
-
Case(
|
|
165
|
-
description="no cols param",
|
|
166
|
-
template=(
|
|
167
|
-
"\n".join(
|
|
168
|
-
[
|
|
169
|
-
"{% tablerow i in (1..2) %}",
|
|
170
|
-
"col: {{ tablerowloop.col }}",
|
|
171
|
-
"col0: {{ tablerowloop.col0 }}",
|
|
172
|
-
"col_first: {{ tablerowloop.col_first }}",
|
|
173
|
-
"col_last: {{ tablerowloop.col_last }}",
|
|
174
|
-
"first: {{ tablerowloop.first }}",
|
|
175
|
-
"index: {{ tablerowloop.index }}",
|
|
176
|
-
"index0: {{ tablerowloop.index0 }}",
|
|
177
|
-
"last: {{ tablerowloop.last }}",
|
|
178
|
-
"length: {{ tablerowloop.length }}",
|
|
179
|
-
"rindex: {{ tablerowloop.rindex }}",
|
|
180
|
-
"rindex0: {{ tablerowloop.rindex0 }}",
|
|
181
|
-
"row: {{ tablerowloop.row }}",
|
|
182
|
-
"{% endtablerow %}",
|
|
183
|
-
]
|
|
184
|
-
)
|
|
185
|
-
),
|
|
186
|
-
expect=(
|
|
187
|
-
"\n".join(
|
|
188
|
-
[
|
|
189
|
-
'<tr class="row1">',
|
|
190
|
-
'<td class="col1">',
|
|
191
|
-
"col: 1",
|
|
192
|
-
"col0: 0",
|
|
193
|
-
"col_first: true",
|
|
194
|
-
"col_last: false",
|
|
195
|
-
"first: true",
|
|
196
|
-
"index: 1",
|
|
197
|
-
"index0: 0",
|
|
198
|
-
"last: false",
|
|
199
|
-
"length: 2",
|
|
200
|
-
"rindex: 2",
|
|
201
|
-
"rindex0: 1",
|
|
202
|
-
"row: 1",
|
|
203
|
-
'</td><td class="col2">',
|
|
204
|
-
"col: 2",
|
|
205
|
-
"col0: 1",
|
|
206
|
-
"col_first: false",
|
|
207
|
-
"col_last: true",
|
|
208
|
-
"first: false",
|
|
209
|
-
"index: 2",
|
|
210
|
-
"index0: 1",
|
|
211
|
-
"last: true",
|
|
212
|
-
"length: 2",
|
|
213
|
-
"rindex: 1",
|
|
214
|
-
"rindex0: 0",
|
|
215
|
-
"row: 1",
|
|
216
|
-
"</td></tr>\n",
|
|
217
|
-
]
|
|
218
|
-
)
|
|
219
|
-
),
|
|
220
|
-
),
|
|
221
|
-
Case(
|
|
222
|
-
description="cols is a string",
|
|
223
|
-
template=(
|
|
224
|
-
r"{% tablerow i in (1..4) cols:'2' %}"
|
|
225
|
-
r"{{ i }} {{ tablerowloop.col_first }}"
|
|
226
|
-
r"{% endtablerow %}"
|
|
227
|
-
),
|
|
228
|
-
expect=(
|
|
229
|
-
'<tr class="row1">\n'
|
|
230
|
-
'<td class="col1">1 true</td>'
|
|
231
|
-
'<td class="col2">2 false</td>'
|
|
232
|
-
"</tr>\n"
|
|
233
|
-
'<tr class="row2">'
|
|
234
|
-
'<td class="col1">3 true</td>'
|
|
235
|
-
'<td class="col2">4 false</td>'
|
|
236
|
-
"</tr>\n"
|
|
237
|
-
),
|
|
238
|
-
),
|
|
239
|
-
Case(
|
|
240
|
-
description="cols is a float",
|
|
241
|
-
template=(
|
|
242
|
-
r"{% tablerow i in (1..4) cols:2.6 %}"
|
|
243
|
-
r"{{ i }} {{ tablerowloop.col_first }}"
|
|
244
|
-
r"{% endtablerow %}"
|
|
245
|
-
),
|
|
246
|
-
expect=(
|
|
247
|
-
'<tr class="row1">\n'
|
|
248
|
-
'<td class="col1">1 true</td>'
|
|
249
|
-
'<td class="col2">2 false</td>'
|
|
250
|
-
"</tr>\n"
|
|
251
|
-
'<tr class="row2">'
|
|
252
|
-
'<td class="col1">3 true</td>'
|
|
253
|
-
'<td class="col2">4 false</td>'
|
|
254
|
-
"</tr>\n"
|
|
255
|
-
),
|
|
256
|
-
),
|
|
257
|
-
Case(
|
|
258
|
-
description="limit is a string",
|
|
259
|
-
template=(
|
|
260
|
-
r"{% tablerow i in (1..4) limit:'2' %}"
|
|
261
|
-
r"{{ i }} {{ tablerowloop.col_first }}"
|
|
262
|
-
r"{% endtablerow %}"
|
|
263
|
-
),
|
|
264
|
-
expect=(
|
|
265
|
-
'<tr class="row1">\n'
|
|
266
|
-
'<td class="col1">1 true</td>'
|
|
267
|
-
'<td class="col2">2 false</td>'
|
|
268
|
-
"</tr>\n"
|
|
269
|
-
),
|
|
270
|
-
),
|
|
271
|
-
Case(
|
|
272
|
-
description="offset is a string",
|
|
273
|
-
template=(
|
|
274
|
-
r"{% tablerow i in (1..4) offset:'2' %}"
|
|
275
|
-
r"{{ i }} {{ tablerowloop.col_first }}"
|
|
276
|
-
r"{% endtablerow %}"
|
|
277
|
-
),
|
|
278
|
-
expect=(
|
|
279
|
-
'<tr class="row1">\n'
|
|
280
|
-
'<td class="col1">3 true</td>'
|
|
281
|
-
'<td class="col2">4 false</td>'
|
|
282
|
-
"</tr>\n"
|
|
283
|
-
),
|
|
284
|
-
),
|
|
285
|
-
Case(
|
|
286
|
-
description="break from a tablerow loop",
|
|
287
|
-
template=(
|
|
288
|
-
r"{% tablerow n in (1..3) cols:2 %}"
|
|
289
|
-
r"{{n}}{% break %}{{n}}"
|
|
290
|
-
r"{% endtablerow %}"
|
|
291
|
-
),
|
|
292
|
-
expect='<tr class="row1">\n<td class="col1">1</td></tr>\n',
|
|
293
|
-
future=True,
|
|
294
|
-
),
|
|
295
|
-
Case(
|
|
296
|
-
description="continue from a tablerow loop",
|
|
297
|
-
template=(
|
|
298
|
-
r"{% tablerow n in (1..3) cols:2 %}"
|
|
299
|
-
r"{{n}}{% continue %}{{n}}"
|
|
300
|
-
r"{% endtablerow %}"
|
|
301
|
-
),
|
|
302
|
-
expect=(
|
|
303
|
-
'<tr class="row1">\n'
|
|
304
|
-
'<td class="col1">1</td>'
|
|
305
|
-
'<td class="col2">2</td>'
|
|
306
|
-
"</tr>\n"
|
|
307
|
-
'<tr class="row2">'
|
|
308
|
-
'<td class="col1">3</td>'
|
|
309
|
-
"</tr>\n"
|
|
310
|
-
),
|
|
311
|
-
future=True,
|
|
312
|
-
),
|
|
313
|
-
Case(
|
|
314
|
-
description="break from a tablerow loop inside a for loop",
|
|
315
|
-
template=(
|
|
316
|
-
r"{% for i in (1..2) -%}\n"
|
|
317
|
-
r"{% for j in (1..2) -%}\n"
|
|
318
|
-
r"{% tablerow k in (1..3) %}{% break %}{% endtablerow -%}\n"
|
|
319
|
-
r"loop j={{ j }}\n"
|
|
320
|
-
r"{% endfor -%}\n"
|
|
321
|
-
r"loop i={{ i }}\n"
|
|
322
|
-
r"{% endfor -%}\n"
|
|
323
|
-
r"after loop\n"
|
|
324
|
-
),
|
|
325
|
-
expect="\n".join(
|
|
326
|
-
[
|
|
327
|
-
r'\n\n<tr class="row1">',
|
|
328
|
-
r'<td class="col1"></td></tr>',
|
|
329
|
-
r'\nloop j=1\n\n<tr class="row1">',
|
|
330
|
-
r'<td class="col1"></td></tr>',
|
|
331
|
-
r'\nloop j=2\n\nloop i=1\n\n\n<tr class="row1">',
|
|
332
|
-
r'<td class="col1"></td></tr>',
|
|
333
|
-
r'\nloop j=1\n\n<tr class="row1">',
|
|
334
|
-
r'<td class="col1"></td></tr>',
|
|
335
|
-
r"\nloop j=2\n\nloop i=2\n\nafter loop\n",
|
|
336
|
-
]
|
|
337
|
-
),
|
|
338
|
-
future=True,
|
|
339
|
-
),
|
|
340
|
-
# Case(
|
|
341
|
-
# description="cols is non number string",
|
|
342
|
-
# template=(
|
|
343
|
-
# r"{% tablerow i in (1..4) cols:'foo' %}"
|
|
344
|
-
# r"{{ i }} {{ tablerowloop.col_first }}"
|
|
345
|
-
# r"{% endtablerow %}"
|
|
346
|
-
# ),
|
|
347
|
-
# expect=(
|
|
348
|
-
# '<tr class="row1">\n'
|
|
349
|
-
# '<td class="col1">1 true</td>'
|
|
350
|
-
# '<td class="col2">2 false</td>'
|
|
351
|
-
# '<td class="col3">3 false</td>'
|
|
352
|
-
# '<td class="col4">4 false</td>'
|
|
353
|
-
# "</tr>\n"
|
|
354
|
-
# ),
|
|
355
|
-
# ),
|
|
356
|
-
# Case(
|
|
357
|
-
# description="limit is non number string",
|
|
358
|
-
# template=(
|
|
359
|
-
# r"{% tablerow i in (1..4) limit:'foo' %}"
|
|
360
|
-
# r"{{ i }} {{ tablerowloop.col_first }}"
|
|
361
|
-
# r"{% endtablerow %}"
|
|
362
|
-
# ),
|
|
363
|
-
# expect='<tr class="row1">\n</tr>\n',
|
|
364
|
-
# ),
|
|
365
|
-
# Case(
|
|
366
|
-
# description="offset is non number string",
|
|
367
|
-
# template=(
|
|
368
|
-
# r"{% tablerow i in (1..4) offset:'foo' %}"
|
|
369
|
-
# r"{{ i }} {{ tablerowloop.col_first }}"
|
|
370
|
-
# r"{% endtablerow %}"
|
|
371
|
-
# ),
|
|
372
|
-
# expect=(
|
|
373
|
-
# '<tr class="row1">\n'
|
|
374
|
-
# '<td class="col1">1 true</td>'
|
|
375
|
-
# '<td class="col2">2 false</td>'
|
|
376
|
-
# '<td class="col3">3 false</td>'
|
|
377
|
-
# '<td class="col4">4 false</td>'
|
|
378
|
-
# "</tr>\n"
|
|
379
|
-
# ),
|
|
380
|
-
# ),
|
|
381
|
-
# Case(
|
|
382
|
-
# description="offset is an array",
|
|
383
|
-
# template=(
|
|
384
|
-
# r"{% tablerow i in (1..4) offset:foo %}"
|
|
385
|
-
# r"{{ i }} {{ tablerowloop.col_first }}"
|
|
386
|
-
# r"{% endtablerow %}"
|
|
387
|
-
# ),
|
|
388
|
-
# expect=(
|
|
389
|
-
# '<tr class="row1">\n'
|
|
390
|
-
# '<td class="col1">1 true</td>'
|
|
391
|
-
# '<td class="col2">2 false</td>'
|
|
392
|
-
# '<td class="col3">3 false</td>'
|
|
393
|
-
# '<td class="col4">4 false</td>'
|
|
394
|
-
# "</tr>\n"
|
|
395
|
-
# ),
|
|
396
|
-
# globals={"foo": [1, 2, 3]},
|
|
397
|
-
# error=True,
|
|
398
|
-
# ),
|
|
399
|
-
]
|
liquid/golden/times_filter.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `times` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="int times int",
|
|
8
|
-
template=r"{{ 5 | times: 2 }}",
|
|
9
|
-
expect="10",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="int times float",
|
|
13
|
-
template=r"{{ 5 | times: 2.1 }}",
|
|
14
|
-
expect="10.5",
|
|
15
|
-
),
|
|
16
|
-
Case(
|
|
17
|
-
description="float times float",
|
|
18
|
-
template=r"{{ 5.0 | times: 2.1 }}",
|
|
19
|
-
expect="10.5",
|
|
20
|
-
),
|
|
21
|
-
Case(
|
|
22
|
-
description="string times string",
|
|
23
|
-
template=r'{{ "5.0" | times: "2.1" }}',
|
|
24
|
-
expect="10.5",
|
|
25
|
-
),
|
|
26
|
-
Case(
|
|
27
|
-
description="negative multiplication",
|
|
28
|
-
template=r"{{ -5 | times: 2 }}",
|
|
29
|
-
expect="-10",
|
|
30
|
-
),
|
|
31
|
-
Case(
|
|
32
|
-
description="missing arg",
|
|
33
|
-
template=r"{{ 5 | times }}",
|
|
34
|
-
expect="",
|
|
35
|
-
error=True,
|
|
36
|
-
),
|
|
37
|
-
Case(
|
|
38
|
-
description="too many args",
|
|
39
|
-
template=r"{{ 5 | times: 1, 2 }}",
|
|
40
|
-
expect="",
|
|
41
|
-
error=True,
|
|
42
|
-
),
|
|
43
|
-
Case(
|
|
44
|
-
description="undefined left value",
|
|
45
|
-
template=r"{{ nosuchthing | times: 2 }}",
|
|
46
|
-
expect="0",
|
|
47
|
-
),
|
|
48
|
-
Case(
|
|
49
|
-
description="undefined argument",
|
|
50
|
-
template=r"{{ 5 | times: nosuchthing }}",
|
|
51
|
-
expect="0",
|
|
52
|
-
),
|
|
53
|
-
]
|
liquid/golden/truncate_filter.py
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `truncate` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="default end",
|
|
8
|
-
template=r'{{ "Ground control to Major Tom." | truncate: 20 }}',
|
|
9
|
-
expect="Ground control to...",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="custom end",
|
|
13
|
-
template=r'{{ "Ground control to Major Tom." | truncate: 25, ", and so on" }}',
|
|
14
|
-
expect="Ground control, and so on",
|
|
15
|
-
),
|
|
16
|
-
Case(
|
|
17
|
-
description="no end",
|
|
18
|
-
template=r'{{ "Ground control to Major Tom." | truncate: 20, "" }}',
|
|
19
|
-
expect="Ground control to Ma",
|
|
20
|
-
),
|
|
21
|
-
Case(
|
|
22
|
-
description="string is shorter than length",
|
|
23
|
-
template=r'{{ "Ground control" | truncate: 20 }}',
|
|
24
|
-
expect="Ground control",
|
|
25
|
-
),
|
|
26
|
-
Case(
|
|
27
|
-
description="not a string",
|
|
28
|
-
template=r"{{ 5 | truncate: 10 }}",
|
|
29
|
-
expect="5",
|
|
30
|
-
),
|
|
31
|
-
Case(
|
|
32
|
-
description="too many arguments",
|
|
33
|
-
template=r'{{ "hello" | truncate: 5, "foo", "bar" }}',
|
|
34
|
-
expect="",
|
|
35
|
-
error=True,
|
|
36
|
-
),
|
|
37
|
-
Case(
|
|
38
|
-
description="undefined left value",
|
|
39
|
-
template=r"{{ nosuchthing | truncate: 5 }}",
|
|
40
|
-
expect="",
|
|
41
|
-
),
|
|
42
|
-
Case(
|
|
43
|
-
description="undefined first argument",
|
|
44
|
-
template=r'{{ "Ground control to Major Tom." | truncate: nosuchthing }}',
|
|
45
|
-
expect="",
|
|
46
|
-
error=True,
|
|
47
|
-
),
|
|
48
|
-
Case(
|
|
49
|
-
description="undefined second argument",
|
|
50
|
-
template=r'{{ "Ground control to Major Tom." | truncate: 20, nosuchthing }}',
|
|
51
|
-
expect="Ground control to Ma",
|
|
52
|
-
),
|
|
53
|
-
Case(
|
|
54
|
-
description="default length is 50",
|
|
55
|
-
template=(
|
|
56
|
-
r'{{ "Ground control to Major Tom. Ground control to Major Tom." '
|
|
57
|
-
r"| truncate }}"
|
|
58
|
-
),
|
|
59
|
-
expect="Ground control to Major Tom. Ground control to ...",
|
|
60
|
-
),
|
|
61
|
-
]
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `truncatewords` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="default end",
|
|
8
|
-
template=r'{{ "Ground control to Major Tom." | truncatewords: 3 }}',
|
|
9
|
-
expect="Ground control to...",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="custom end",
|
|
13
|
-
template=r'{{ "Ground control to Major Tom." | truncatewords: 3, "--" }}',
|
|
14
|
-
expect="Ground control to--",
|
|
15
|
-
),
|
|
16
|
-
Case(
|
|
17
|
-
description="no end",
|
|
18
|
-
template=r'{{ "Ground control to Major Tom." | truncatewords: 3, "" }}',
|
|
19
|
-
expect="Ground control to",
|
|
20
|
-
),
|
|
21
|
-
Case(
|
|
22
|
-
description="fewer words than word count",
|
|
23
|
-
template=r'{{ "Ground control" | truncatewords: 3 }}',
|
|
24
|
-
expect="Ground control",
|
|
25
|
-
),
|
|
26
|
-
Case(
|
|
27
|
-
description="not a string",
|
|
28
|
-
template="{{ 5 | truncatewords: 10 }}",
|
|
29
|
-
expect="5",
|
|
30
|
-
),
|
|
31
|
-
Case(
|
|
32
|
-
description="too many arguments",
|
|
33
|
-
template='{{ "hello" | truncatewords: 5, "foo", "bar" }}',
|
|
34
|
-
expect="",
|
|
35
|
-
error=True,
|
|
36
|
-
),
|
|
37
|
-
Case(
|
|
38
|
-
description="reference implementation test 1",
|
|
39
|
-
template=r'{{ "测试测试测试测试" | truncatewords: 5 }}',
|
|
40
|
-
expect="测试测试测试测试",
|
|
41
|
-
),
|
|
42
|
-
Case(
|
|
43
|
-
description="reference implementation test 2",
|
|
44
|
-
template=r'{{ "one two three" | truncatewords: 2, 1 }}',
|
|
45
|
-
expect="one two1",
|
|
46
|
-
),
|
|
47
|
-
Case(
|
|
48
|
-
description="reference implementation test 3",
|
|
49
|
-
template='{{ "one two\tthree\nfour" | truncatewords: 3 }}',
|
|
50
|
-
expect="one two three...",
|
|
51
|
-
),
|
|
52
|
-
Case(
|
|
53
|
-
description="reference implementation test 4",
|
|
54
|
-
template=r'{{ "one two three four" | truncatewords: 2 }}',
|
|
55
|
-
expect="one two...",
|
|
56
|
-
),
|
|
57
|
-
Case(
|
|
58
|
-
description="reference implementation test 5",
|
|
59
|
-
template=r'{{ "one two three four" | truncatewords: 0 }}',
|
|
60
|
-
expect="one...",
|
|
61
|
-
),
|
|
62
|
-
Case(
|
|
63
|
-
description="undefined left value",
|
|
64
|
-
template=r"{{ nosuchthing | truncatewords: 5 }}",
|
|
65
|
-
expect="",
|
|
66
|
-
),
|
|
67
|
-
Case(
|
|
68
|
-
description="undefined first argument",
|
|
69
|
-
template=r'{{ "one two three four" | truncatewords: nosuchthing }}',
|
|
70
|
-
expect="",
|
|
71
|
-
error=True,
|
|
72
|
-
),
|
|
73
|
-
Case(
|
|
74
|
-
description="undefined second argument",
|
|
75
|
-
template=r'{{ "one two three four" | truncatewords: 2, nosuchthing }}',
|
|
76
|
-
expect="one two",
|
|
77
|
-
),
|
|
78
|
-
# Case(
|
|
79
|
-
# description="very big argument",
|
|
80
|
-
# template=r'{{ "" | truncatewords: 100000000000000 }}',
|
|
81
|
-
# expect="",
|
|
82
|
-
# error=False,
|
|
83
|
-
# ),
|
|
84
|
-
Case(
|
|
85
|
-
description="number of words defaults to 15",
|
|
86
|
-
template=r'{{ "a b c d e f g h i j k l m n o p q" | truncatewords }}',
|
|
87
|
-
expect="a b c d e f g h i j k l m n o...",
|
|
88
|
-
),
|
|
89
|
-
Case(
|
|
90
|
-
description="all whitespace is clobbered",
|
|
91
|
-
template=r'{{ " one two three four " | truncatewords: 2 }}',
|
|
92
|
-
expect="one two...",
|
|
93
|
-
),
|
|
94
|
-
]
|
liquid/golden/uniq_filter.py
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `uniq` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="array of strings",
|
|
8
|
-
template=r"{{ a | uniq | join: '#' }}",
|
|
9
|
-
expect="a#b",
|
|
10
|
-
globals={"a": ["a", "b", "b", "a"]},
|
|
11
|
-
),
|
|
12
|
-
Case(
|
|
13
|
-
description="array of things",
|
|
14
|
-
template=r"{{ a | uniq | join: '#' }}",
|
|
15
|
-
expect="a#b#1",
|
|
16
|
-
globals={"a": ["a", "b", 1, 1]},
|
|
17
|
-
),
|
|
18
|
-
Case(
|
|
19
|
-
description="empty array",
|
|
20
|
-
template=r"{{ a | uniq | join: '#' }}",
|
|
21
|
-
expect="",
|
|
22
|
-
globals={"a": []},
|
|
23
|
-
),
|
|
24
|
-
Case(
|
|
25
|
-
description="unhashable items",
|
|
26
|
-
template=r"{{ a | uniq | join: '#' }}",
|
|
27
|
-
expect=r"a#b#{}",
|
|
28
|
-
globals={"a": ["a", "b", [], {}, {}]},
|
|
29
|
-
),
|
|
30
|
-
Case(
|
|
31
|
-
description="left value is not an array",
|
|
32
|
-
template=r"{{ a | uniq | join: '#' }}",
|
|
33
|
-
expect="123",
|
|
34
|
-
globals={"a": 123},
|
|
35
|
-
),
|
|
36
|
-
Case(
|
|
37
|
-
description="left value is undefined",
|
|
38
|
-
template=r"{{ nosuchthing | uniq | join: '#' }}",
|
|
39
|
-
expect="",
|
|
40
|
-
),
|
|
41
|
-
Case(
|
|
42
|
-
description="too many arguments",
|
|
43
|
-
template=r"{{ nosuchthing | uniq: 'foo', 'bar' }}",
|
|
44
|
-
expect="",
|
|
45
|
-
error=True,
|
|
46
|
-
),
|
|
47
|
-
Case(
|
|
48
|
-
description="array of objects with key property",
|
|
49
|
-
template=(
|
|
50
|
-
r"{% assign x = a | uniq: 'title' %}"
|
|
51
|
-
r"{% for obj in x %}"
|
|
52
|
-
r"{% for i in obj %}"
|
|
53
|
-
r"({{ i[0] }},{{ i[1] }})"
|
|
54
|
-
r"{% endfor %}"
|
|
55
|
-
r"{% endfor %}"
|
|
56
|
-
),
|
|
57
|
-
expect="(title,foo)(name,a)(title,bar)(name,c)",
|
|
58
|
-
globals={
|
|
59
|
-
"a": [
|
|
60
|
-
{"title": "foo", "name": "a"},
|
|
61
|
-
{"title": "foo", "name": "b"},
|
|
62
|
-
{"title": "bar", "name": "c"},
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
),
|
|
66
|
-
Case(
|
|
67
|
-
description="array of objects with missing key property",
|
|
68
|
-
template=(
|
|
69
|
-
r"{% assign x = a | uniq: 'title' %}"
|
|
70
|
-
r"{% for obj in x %}"
|
|
71
|
-
r"{% for i in obj %}"
|
|
72
|
-
r"({{ i[0] }},{{ i[1] }})"
|
|
73
|
-
r"{% endfor %}"
|
|
74
|
-
r"{% endfor %}"
|
|
75
|
-
),
|
|
76
|
-
expect="(title,foo)(name,a)(title,bar)(name,c)(heading,bar)(name,c)",
|
|
77
|
-
globals={
|
|
78
|
-
"a": [
|
|
79
|
-
{"title": "foo", "name": "a"},
|
|
80
|
-
{"title": "foo", "name": "b"},
|
|
81
|
-
{"title": "bar", "name": "c"},
|
|
82
|
-
{"heading": "bar", "name": "c"},
|
|
83
|
-
{"heading": "baz", "name": "d"},
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
),
|
|
87
|
-
]
|