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/if_tag.py
DELETED
|
@@ -1,531 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's `if` tag."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="condition with literal consequence",
|
|
8
|
-
template=r"{% if product.title == 'foo' %}bar{% endif %}",
|
|
9
|
-
expect="bar",
|
|
10
|
-
globals={"product": {"title": "foo"}},
|
|
11
|
-
),
|
|
12
|
-
Case(
|
|
13
|
-
description="condition with literal consequence and literal alternative",
|
|
14
|
-
template=r"{% if product.title == 'hello' %}bar{% else %}baz{% endif %}",
|
|
15
|
-
expect="baz",
|
|
16
|
-
globals={"product": {"title": "foo"}},
|
|
17
|
-
),
|
|
18
|
-
Case(
|
|
19
|
-
description="condition with conditional alternative",
|
|
20
|
-
template=(
|
|
21
|
-
r"{% if product.title == 'hello' %}"
|
|
22
|
-
r"foo"
|
|
23
|
-
r"{% elsif product.title == 'foo' %}"
|
|
24
|
-
r"bar"
|
|
25
|
-
r"{% endif %}"
|
|
26
|
-
),
|
|
27
|
-
expect="bar",
|
|
28
|
-
globals={"product": {"title": "foo"}},
|
|
29
|
-
),
|
|
30
|
-
Case(
|
|
31
|
-
description="condition with conditional alternative and final alternative",
|
|
32
|
-
template=(
|
|
33
|
-
r"{% if product.title == 'hello' %}"
|
|
34
|
-
r"foo"
|
|
35
|
-
r"{% elsif product.title == 'goodbye' %}"
|
|
36
|
-
r"bar"
|
|
37
|
-
r"{% else %}"
|
|
38
|
-
r"baz"
|
|
39
|
-
r"{% endif %}"
|
|
40
|
-
),
|
|
41
|
-
expect="baz",
|
|
42
|
-
globals={"product": {"title": "foo"}},
|
|
43
|
-
),
|
|
44
|
-
Case(
|
|
45
|
-
description="non-empty hash is truthy",
|
|
46
|
-
template=r"{% if product %}bar{% else %}foo{% endif %}",
|
|
47
|
-
expect="bar",
|
|
48
|
-
globals={"product": {"title": "foo"}},
|
|
49
|
-
),
|
|
50
|
-
Case(
|
|
51
|
-
description="literal nil is falsy",
|
|
52
|
-
template=r"{% if nil %}bar{% else %}foo{% endif %}",
|
|
53
|
-
expect="foo",
|
|
54
|
-
),
|
|
55
|
-
Case(
|
|
56
|
-
description="undefined variables are falsy",
|
|
57
|
-
template=r"{% if nosuchthing %}bar{% else %}foo{% endif %}",
|
|
58
|
-
expect="foo",
|
|
59
|
-
),
|
|
60
|
-
Case(
|
|
61
|
-
description="nested condition in the consequence block",
|
|
62
|
-
template=(
|
|
63
|
-
r"{% if product %}"
|
|
64
|
-
r"{% if title == 'Hello' %}"
|
|
65
|
-
r"baz"
|
|
66
|
-
r"{% endif %}"
|
|
67
|
-
r"{% endif %}"
|
|
68
|
-
),
|
|
69
|
-
expect="baz",
|
|
70
|
-
globals={
|
|
71
|
-
"product": {"title": "foo"},
|
|
72
|
-
"title": "Hello",
|
|
73
|
-
},
|
|
74
|
-
),
|
|
75
|
-
Case(
|
|
76
|
-
description="nested condition, alternative in the consequence block",
|
|
77
|
-
template=(
|
|
78
|
-
r"{% if product %}"
|
|
79
|
-
r"{% if title == 'goodbye' %}"
|
|
80
|
-
r"baz"
|
|
81
|
-
r"{% else %}"
|
|
82
|
-
r"hello"
|
|
83
|
-
r"{% endif %}"
|
|
84
|
-
r"{% endif %}"
|
|
85
|
-
),
|
|
86
|
-
expect="hello",
|
|
87
|
-
globals={"product": {"title": "foo"}, "title": "Hello"},
|
|
88
|
-
),
|
|
89
|
-
Case(
|
|
90
|
-
description="literal false condition",
|
|
91
|
-
template=r"{% if false %}{% endif %}",
|
|
92
|
-
expect="",
|
|
93
|
-
),
|
|
94
|
-
Case(
|
|
95
|
-
description="contains condition",
|
|
96
|
-
template=r"{% if product.tags contains 'garden' %}baz{% endif %}",
|
|
97
|
-
expect="baz",
|
|
98
|
-
globals={"product": {"tags": ["sports", "garden"]}},
|
|
99
|
-
),
|
|
100
|
-
Case(
|
|
101
|
-
description="not equal condition",
|
|
102
|
-
template=r"{% if product.title != 'foo' %}baz{% endif %}",
|
|
103
|
-
expect="",
|
|
104
|
-
globals={"product": {"title": "foo"}},
|
|
105
|
-
),
|
|
106
|
-
Case(
|
|
107
|
-
description="alternate not equal condition",
|
|
108
|
-
template=r"{% if product.title <> 'foo' %}baz{% endif %}",
|
|
109
|
-
expect="",
|
|
110
|
-
globals={"product": {"title": "foo"}},
|
|
111
|
-
),
|
|
112
|
-
Case(
|
|
113
|
-
description="blocks that contain only whitespace are not rendered",
|
|
114
|
-
template=r"{% if true %} {% elsif false %} {% else %} {% endif %}",
|
|
115
|
-
expect="",
|
|
116
|
-
),
|
|
117
|
-
Case(
|
|
118
|
-
description=(
|
|
119
|
-
"blocks that contain only whitespace and comments are not rendered"
|
|
120
|
-
),
|
|
121
|
-
template=(
|
|
122
|
-
r"{% if true %} "
|
|
123
|
-
r"{% comment %} this is blank {% endcomment %} "
|
|
124
|
-
r"{% endif %}"
|
|
125
|
-
),
|
|
126
|
-
expect="",
|
|
127
|
-
),
|
|
128
|
-
Case(
|
|
129
|
-
description="compare empty string literal to blank",
|
|
130
|
-
template=r"{% if '' == blank %}is blank{% endif %}",
|
|
131
|
-
expect="is blank",
|
|
132
|
-
standard=False,
|
|
133
|
-
),
|
|
134
|
-
Case(
|
|
135
|
-
description="conditional alternative with default",
|
|
136
|
-
template=(
|
|
137
|
-
r"{% if false %}foo"
|
|
138
|
-
r"{% elsif false %}bar"
|
|
139
|
-
r"{% else %}hello"
|
|
140
|
-
r"{% endif %}"
|
|
141
|
-
),
|
|
142
|
-
expect="hello",
|
|
143
|
-
),
|
|
144
|
-
Case(
|
|
145
|
-
description="range equals range",
|
|
146
|
-
template=(
|
|
147
|
-
r"{% assign foo = (1..3) %}"
|
|
148
|
-
r"{% if foo == (1..3) %}true"
|
|
149
|
-
r"{% else %}false"
|
|
150
|
-
r"{% endif %}"
|
|
151
|
-
),
|
|
152
|
-
expect="true",
|
|
153
|
-
),
|
|
154
|
-
Case(
|
|
155
|
-
description="logical operators are right associative",
|
|
156
|
-
template=r"{% if true and false and false or true %}hello{% endif %}",
|
|
157
|
-
expect="",
|
|
158
|
-
),
|
|
159
|
-
Case(
|
|
160
|
-
description="zero is not equal to false",
|
|
161
|
-
template=r"{% if 0 == false %}Hello{% else %}Goodbye{% endif %}",
|
|
162
|
-
expect="Goodbye",
|
|
163
|
-
),
|
|
164
|
-
Case(
|
|
165
|
-
description="zero is truthy",
|
|
166
|
-
template=r"{% if 0 %}Hello{% else %}Goodbye{% endif %}",
|
|
167
|
-
expect="Hello",
|
|
168
|
-
),
|
|
169
|
-
Case(
|
|
170
|
-
description="0.0 is truthy",
|
|
171
|
-
template=(r"{% if 0.0 %}Hello{% else %}Goodbye{% endif %}"),
|
|
172
|
-
expect="Hello",
|
|
173
|
-
),
|
|
174
|
-
Case(
|
|
175
|
-
description="one is not equal to true",
|
|
176
|
-
template=(r"{% if 1 == true %}Hello{% else %}Goodbye{% endif %}"),
|
|
177
|
-
expect="Goodbye",
|
|
178
|
-
),
|
|
179
|
-
Case(
|
|
180
|
-
description="array is equal to array",
|
|
181
|
-
template=(
|
|
182
|
-
"{% assign x = 'a,b,c' | split: ',' %}"
|
|
183
|
-
"{% assign y = 'a,b,c' | split: ',' %}"
|
|
184
|
-
"{% if x == y %}true{% else %}false{% endif %}"
|
|
185
|
-
),
|
|
186
|
-
expect="true",
|
|
187
|
-
),
|
|
188
|
-
Case(
|
|
189
|
-
description="array is equal to array from context",
|
|
190
|
-
template=(
|
|
191
|
-
"{% assign y = 'a,b,c' | split: ',' %}"
|
|
192
|
-
"{% if x == y %}true{% else %}false{% endif %}"
|
|
193
|
-
),
|
|
194
|
-
globals={"x": ["a", "b", "c"]},
|
|
195
|
-
expect="true",
|
|
196
|
-
),
|
|
197
|
-
Case(
|
|
198
|
-
description="string does not equal int",
|
|
199
|
-
template="{% if '1' == 1 %}true{% else %}false{% endif %}",
|
|
200
|
-
globals={},
|
|
201
|
-
expect="false",
|
|
202
|
-
),
|
|
203
|
-
Case(
|
|
204
|
-
description="int does not equal string",
|
|
205
|
-
template="{% if 1 == '1' %}true{% else %}false{% endif %}",
|
|
206
|
-
globals={},
|
|
207
|
-
expect="false",
|
|
208
|
-
),
|
|
209
|
-
Case(
|
|
210
|
-
description="int equals float",
|
|
211
|
-
template="{% if 1 == 1.0 %}true{% else %}false{% endif %}",
|
|
212
|
-
globals={},
|
|
213
|
-
expect="true",
|
|
214
|
-
),
|
|
215
|
-
Case(
|
|
216
|
-
description="string greater than int",
|
|
217
|
-
template="{% if '2' > 1 %}true{% else %}false{% endif %}",
|
|
218
|
-
globals={},
|
|
219
|
-
expect="false",
|
|
220
|
-
error=True,
|
|
221
|
-
),
|
|
222
|
-
Case(
|
|
223
|
-
description="string is less than string",
|
|
224
|
-
template="{% if 'abc' < 'acb' %}true{% else %}false{% endif %}",
|
|
225
|
-
globals={},
|
|
226
|
-
expect="true",
|
|
227
|
-
),
|
|
228
|
-
Case(
|
|
229
|
-
description="string is not less than string",
|
|
230
|
-
template="{% if 'bbb' < 'aaa' %}true{% else %}false{% endif %}",
|
|
231
|
-
globals={},
|
|
232
|
-
expect="false",
|
|
233
|
-
),
|
|
234
|
-
Case(
|
|
235
|
-
description="string is less than or equal to string",
|
|
236
|
-
template="{% if 'abc' <= 'acb' %}true{% else %}false{% endif %}",
|
|
237
|
-
globals={},
|
|
238
|
-
expect="true",
|
|
239
|
-
),
|
|
240
|
-
Case(
|
|
241
|
-
description="string is not less than or equal to string",
|
|
242
|
-
template="{% if 'bbb' <= 'aaa' %}true{% else %}false{% endif %}",
|
|
243
|
-
globals={},
|
|
244
|
-
expect="false",
|
|
245
|
-
),
|
|
246
|
-
Case(
|
|
247
|
-
description="string is greater than string",
|
|
248
|
-
template="{% if 'abc' > 'acb' %}true{% else %}false{% endif %}",
|
|
249
|
-
globals={},
|
|
250
|
-
expect="false",
|
|
251
|
-
),
|
|
252
|
-
Case(
|
|
253
|
-
description="string is not greater than string",
|
|
254
|
-
template="{% if 'bbb' > 'aaa' %}true{% else %}false{% endif %}",
|
|
255
|
-
globals={},
|
|
256
|
-
expect="true",
|
|
257
|
-
),
|
|
258
|
-
Case(
|
|
259
|
-
description="string is greater than or equal to string",
|
|
260
|
-
template="{% if 'abc' >= 'acb' %}true{% else %}false{% endif %}",
|
|
261
|
-
globals={},
|
|
262
|
-
expect="false",
|
|
263
|
-
),
|
|
264
|
-
Case(
|
|
265
|
-
description="string is not greater than or equal to string",
|
|
266
|
-
template="{% if 'bbb' >= 'aaa' %}true{% else %}false{% endif %}",
|
|
267
|
-
globals={},
|
|
268
|
-
expect="true",
|
|
269
|
-
),
|
|
270
|
-
Case(
|
|
271
|
-
description="else tag expressions are ignored",
|
|
272
|
-
template="{% if false %}1{% else nonsense %}2{% endif %}",
|
|
273
|
-
globals={},
|
|
274
|
-
expect="2",
|
|
275
|
-
error=False,
|
|
276
|
-
strict=True,
|
|
277
|
-
future=True,
|
|
278
|
-
),
|
|
279
|
-
Case(
|
|
280
|
-
description="extra else blocks are ignored",
|
|
281
|
-
template="{% if false %}1{% else %}2{% else %}3{% endif %}",
|
|
282
|
-
globals={},
|
|
283
|
-
expect="2",
|
|
284
|
-
error=False,
|
|
285
|
-
strict=True,
|
|
286
|
-
future=True,
|
|
287
|
-
),
|
|
288
|
-
Case(
|
|
289
|
-
description="extra elsif blocks are ignored",
|
|
290
|
-
template="{% if false %}1{% else %}2{% elsif true %}3{% endif %}",
|
|
291
|
-
globals={},
|
|
292
|
-
expect="2",
|
|
293
|
-
error=False,
|
|
294
|
-
strict=True,
|
|
295
|
-
future=True,
|
|
296
|
-
),
|
|
297
|
-
Case(
|
|
298
|
-
description="empty array equals special empty",
|
|
299
|
-
template="{% if x == empty %}TRUE{% else %}FALSE{% endif %}",
|
|
300
|
-
expect="TRUE",
|
|
301
|
-
globals={"x": []},
|
|
302
|
-
partials={},
|
|
303
|
-
error=False,
|
|
304
|
-
strict=False,
|
|
305
|
-
),
|
|
306
|
-
Case(
|
|
307
|
-
description="empty array is truthy",
|
|
308
|
-
template="{% if x %}TRUE{% else %}FALSE{% endif %}",
|
|
309
|
-
expect="TRUE",
|
|
310
|
-
globals={"x": []},
|
|
311
|
-
partials={},
|
|
312
|
-
error=False,
|
|
313
|
-
strict=False,
|
|
314
|
-
),
|
|
315
|
-
Case(
|
|
316
|
-
description="empty object equals special empty",
|
|
317
|
-
template="{% if x == empty %}TRUE{% else %}FALSE{% endif %}",
|
|
318
|
-
expect="TRUE",
|
|
319
|
-
globals={"x": {}},
|
|
320
|
-
partials={},
|
|
321
|
-
error=False,
|
|
322
|
-
strict=False,
|
|
323
|
-
),
|
|
324
|
-
Case(
|
|
325
|
-
description="empty object is truthy",
|
|
326
|
-
template="{% if x %}TRUE{% else %}FALSE{% endif %}",
|
|
327
|
-
expect="TRUE",
|
|
328
|
-
globals={"x": {}},
|
|
329
|
-
partials={},
|
|
330
|
-
error=False,
|
|
331
|
-
strict=False,
|
|
332
|
-
),
|
|
333
|
-
Case(
|
|
334
|
-
description="empty string is truthy",
|
|
335
|
-
template="{% if '' %}TRUE{% else %}FALSE{% endif %}",
|
|
336
|
-
expect="TRUE",
|
|
337
|
-
globals={},
|
|
338
|
-
partials={},
|
|
339
|
-
error=False,
|
|
340
|
-
strict=False,
|
|
341
|
-
),
|
|
342
|
-
Case(
|
|
343
|
-
description="string contains string",
|
|
344
|
-
template="{% if 'hello' contains 'llo' %}TRUE{% else %}FALSE{% endif %}",
|
|
345
|
-
expect="TRUE",
|
|
346
|
-
globals={},
|
|
347
|
-
partials={},
|
|
348
|
-
error=False,
|
|
349
|
-
strict=False,
|
|
350
|
-
),
|
|
351
|
-
Case(
|
|
352
|
-
description="string contains int",
|
|
353
|
-
template="{% if 'hel9lo' contains 9 %}TRUE{% else %}FALSE{% endif %}",
|
|
354
|
-
expect="TRUE",
|
|
355
|
-
globals={},
|
|
356
|
-
partials={},
|
|
357
|
-
error=False,
|
|
358
|
-
strict=False,
|
|
359
|
-
),
|
|
360
|
-
Case(
|
|
361
|
-
description="string contains string from context",
|
|
362
|
-
template="{% if 'hello' contains s %}TRUE{% else %}FALSE{% endif %}",
|
|
363
|
-
expect="TRUE",
|
|
364
|
-
globals={"s": "llo"},
|
|
365
|
-
partials={},
|
|
366
|
-
error=False,
|
|
367
|
-
strict=False,
|
|
368
|
-
),
|
|
369
|
-
Case(
|
|
370
|
-
description="context string contains string from context",
|
|
371
|
-
template="{% if t contains s %}TRUE{% else %}FALSE{% endif %}",
|
|
372
|
-
expect="TRUE",
|
|
373
|
-
globals={"s": "llo", "t": "hello"},
|
|
374
|
-
partials={},
|
|
375
|
-
error=False,
|
|
376
|
-
strict=False,
|
|
377
|
-
),
|
|
378
|
-
Case(
|
|
379
|
-
description="undefined is equal to nil",
|
|
380
|
-
template="{% if nosuchthing == nil %}TRUE{% else %}FALSE{% endif %}",
|
|
381
|
-
expect="TRUE",
|
|
382
|
-
globals={},
|
|
383
|
-
partials={},
|
|
384
|
-
error=False,
|
|
385
|
-
strict=False,
|
|
386
|
-
),
|
|
387
|
-
Case(
|
|
388
|
-
description="undefined is equal to null",
|
|
389
|
-
template="{% if nosuchthing == null %}TRUE{% else %}FALSE{% endif %}",
|
|
390
|
-
expect="TRUE",
|
|
391
|
-
globals={},
|
|
392
|
-
partials={},
|
|
393
|
-
error=False,
|
|
394
|
-
strict=False,
|
|
395
|
-
),
|
|
396
|
-
Case(
|
|
397
|
-
description="string contains undefined",
|
|
398
|
-
template="{% if s contains nosuchthing %}TRUE{% else %}FALSE{% endif %}",
|
|
399
|
-
expect="FALSE",
|
|
400
|
-
globals={"s": "hello"},
|
|
401
|
-
partials={},
|
|
402
|
-
error=False,
|
|
403
|
-
strict=False,
|
|
404
|
-
),
|
|
405
|
-
Case(
|
|
406
|
-
description="array contains undefined",
|
|
407
|
-
template="{% if a contains nosuchthing %}TRUE{% else %}FALSE{% endif %}",
|
|
408
|
-
expect="FALSE",
|
|
409
|
-
globals={"a": [1, 2, 3, None]},
|
|
410
|
-
partials={},
|
|
411
|
-
error=False,
|
|
412
|
-
strict=False,
|
|
413
|
-
),
|
|
414
|
-
Case(
|
|
415
|
-
description="array contains false",
|
|
416
|
-
template="{% if a contains false %}TRUE{% else %}FALSE{% endif %}",
|
|
417
|
-
expect="FALSE",
|
|
418
|
-
globals={"a": [1, 2, 3, False]},
|
|
419
|
-
partials={},
|
|
420
|
-
error=False,
|
|
421
|
-
strict=False,
|
|
422
|
-
),
|
|
423
|
-
Case(
|
|
424
|
-
description="object contains undefined",
|
|
425
|
-
template="{% if obj contains nosuchthing %}TRUE{% else %}FALSE{% endif %}",
|
|
426
|
-
expect="FALSE",
|
|
427
|
-
globals={"obj": {"foo": "bar"}},
|
|
428
|
-
partials={},
|
|
429
|
-
error=False,
|
|
430
|
-
strict=False,
|
|
431
|
-
),
|
|
432
|
-
Case(
|
|
433
|
-
description="string contains nil",
|
|
434
|
-
template="{% if s contains nil %}TRUE{% else %}FALSE{% endif %}",
|
|
435
|
-
expect="FALSE",
|
|
436
|
-
globals={"s": "hello"},
|
|
437
|
-
partials={},
|
|
438
|
-
error=False,
|
|
439
|
-
strict=False,
|
|
440
|
-
),
|
|
441
|
-
Case(
|
|
442
|
-
description="array contains nil",
|
|
443
|
-
template="{% if a contains nil %}TRUE{% else %}FALSE{% endif %}",
|
|
444
|
-
expect="FALSE",
|
|
445
|
-
globals={"a": [1, 2, None]},
|
|
446
|
-
partials={},
|
|
447
|
-
error=False,
|
|
448
|
-
strict=False,
|
|
449
|
-
),
|
|
450
|
-
Case(
|
|
451
|
-
description="object contains nil",
|
|
452
|
-
template="{% if obj contains nosuchthing %}TRUE{% else %}FALSE{% endif %}",
|
|
453
|
-
expect="FALSE",
|
|
454
|
-
globals={"obj": {"foo": "bar"}},
|
|
455
|
-
partials={},
|
|
456
|
-
error=False,
|
|
457
|
-
strict=False,
|
|
458
|
-
),
|
|
459
|
-
Case(
|
|
460
|
-
description="undefined contains string",
|
|
461
|
-
template="{% if undefined contains s %}TRUE{% else %}FALSE{% endif %}",
|
|
462
|
-
expect="FALSE",
|
|
463
|
-
globals={"s": "hello"},
|
|
464
|
-
partials={},
|
|
465
|
-
error=False,
|
|
466
|
-
strict=False,
|
|
467
|
-
),
|
|
468
|
-
Case(
|
|
469
|
-
description="undefined contains array",
|
|
470
|
-
template="{% if undefined contains a %}TRUE{% else %}FALSE{% endif %}",
|
|
471
|
-
expect="FALSE",
|
|
472
|
-
globals={"a": [1, 2, 3]},
|
|
473
|
-
partials={},
|
|
474
|
-
error=False,
|
|
475
|
-
strict=False,
|
|
476
|
-
),
|
|
477
|
-
Case(
|
|
478
|
-
description="undefined contains object",
|
|
479
|
-
template="{% if undefined contains obj %}TRUE{% else %}FALSE{% endif %}",
|
|
480
|
-
expect="FALSE",
|
|
481
|
-
globals={"obj": {"foo": "bar"}},
|
|
482
|
-
partials={},
|
|
483
|
-
error=False,
|
|
484
|
-
strict=False,
|
|
485
|
-
),
|
|
486
|
-
Case(
|
|
487
|
-
description="undefined contains undefined",
|
|
488
|
-
template="{% if undefined contains thing %}TRUE{% else %}FALSE{% endif %}",
|
|
489
|
-
expect="FALSE",
|
|
490
|
-
globals={},
|
|
491
|
-
partials={},
|
|
492
|
-
error=False,
|
|
493
|
-
strict=False,
|
|
494
|
-
),
|
|
495
|
-
Case(
|
|
496
|
-
description="startswith is not a valid operator",
|
|
497
|
-
template="{% if s startswith t %}TRUE{% else %}FALSE{% endif %}",
|
|
498
|
-
expect="",
|
|
499
|
-
globals={"s": "hello", "t": "hell"},
|
|
500
|
-
partials={},
|
|
501
|
-
error=True,
|
|
502
|
-
strict=False,
|
|
503
|
-
),
|
|
504
|
-
Case(
|
|
505
|
-
description="endswith is not a valid operator",
|
|
506
|
-
template="{% if s endswith t %}TRUE{% else %}FALSE{% endif %}",
|
|
507
|
-
expect="",
|
|
508
|
-
globals={"s": "hello", "t": "lo"},
|
|
509
|
-
partials={},
|
|
510
|
-
error=True,
|
|
511
|
-
strict=False,
|
|
512
|
-
),
|
|
513
|
-
Case(
|
|
514
|
-
description="haskey is not a valid operator",
|
|
515
|
-
template="{% if obj haskey x %}TRUE{% else %}FALSE{% endif %}",
|
|
516
|
-
expect="",
|
|
517
|
-
globals={"obj": {"foo": "bar"}, "x": "foo"},
|
|
518
|
-
partials={},
|
|
519
|
-
error=True,
|
|
520
|
-
strict=False,
|
|
521
|
-
),
|
|
522
|
-
Case(
|
|
523
|
-
description="in is not a valid operator",
|
|
524
|
-
template="{% if t in s %}TRUE{% else %}FALSE{% endif %}",
|
|
525
|
-
expect="",
|
|
526
|
-
globals={"s": "hello", "t": "lo"},
|
|
527
|
-
partials={},
|
|
528
|
-
error=True,
|
|
529
|
-
strict=False,
|
|
530
|
-
),
|
|
531
|
-
]
|
liquid/golden/ifchanged_tag.py
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's `ifchanged` tag."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="changed from initial state",
|
|
8
|
-
template=r"{% ifchanged %}hello{% endifchanged %}",
|
|
9
|
-
expect="hello",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="not changed from initial state",
|
|
13
|
-
template=r"{% ifchanged %}{% endifchanged %}",
|
|
14
|
-
expect="",
|
|
15
|
-
),
|
|
16
|
-
Case(
|
|
17
|
-
description="no change from assign",
|
|
18
|
-
template=(
|
|
19
|
-
r"{% assign foo = 'hello' %}"
|
|
20
|
-
r"{% ifchanged %}{{ foo }}{% endifchanged %}"
|
|
21
|
-
r"{% ifchanged %}{{ foo }}{% endifchanged %}"
|
|
22
|
-
),
|
|
23
|
-
expect="hello",
|
|
24
|
-
),
|
|
25
|
-
Case(
|
|
26
|
-
description="change from assign",
|
|
27
|
-
template=(
|
|
28
|
-
r"{% assign foo = 'hello' %}"
|
|
29
|
-
r"{% ifchanged %}{{ foo }}{% endifchanged %}"
|
|
30
|
-
r"{% ifchanged %}{{ foo }}{% endifchanged %}"
|
|
31
|
-
r"{% assign foo = 'goodbye' %}"
|
|
32
|
-
r"{% ifchanged %}{{ foo }}{% endifchanged %}"
|
|
33
|
-
),
|
|
34
|
-
expect="hellogoodbye",
|
|
35
|
-
),
|
|
36
|
-
Case(
|
|
37
|
-
description="within for loop",
|
|
38
|
-
template=(
|
|
39
|
-
r'{% assign list = "1,3,2,1,3,1,2" | split: "," | sort %}'
|
|
40
|
-
r"{% for item in list -%}"
|
|
41
|
-
r"{%- ifchanged %} {{ item }}{% endifchanged -%}"
|
|
42
|
-
r"{%- endfor %}"
|
|
43
|
-
),
|
|
44
|
-
expect=" 1 2 3",
|
|
45
|
-
),
|
|
46
|
-
]
|
liquid/golden/illegal.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing illegal tags."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="unknown tag",
|
|
8
|
-
template=r"{% nosuchthing %}",
|
|
9
|
-
expect="",
|
|
10
|
-
error=True,
|
|
11
|
-
strict=True,
|
|
12
|
-
),
|
|
13
|
-
Case(
|
|
14
|
-
description="no addition operator",
|
|
15
|
-
template=r"{% assign x = 1 + 2 %}{{ x }}",
|
|
16
|
-
expect="",
|
|
17
|
-
error=True,
|
|
18
|
-
strict=True,
|
|
19
|
-
),
|
|
20
|
-
Case(
|
|
21
|
-
description="no subtraction operator",
|
|
22
|
-
template=r"{% assign x = 1 - 2 %}{{ x }}",
|
|
23
|
-
expect="",
|
|
24
|
-
error=True,
|
|
25
|
-
strict=True,
|
|
26
|
-
),
|
|
27
|
-
Case(
|
|
28
|
-
description="no multiplication operator",
|
|
29
|
-
template=r"{% assign x = 2 %}{{ x * 3 }}",
|
|
30
|
-
expect="",
|
|
31
|
-
error=True,
|
|
32
|
-
strict=True,
|
|
33
|
-
),
|
|
34
|
-
]
|