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.
Files changed (98) hide show
  1. liquid/__init__.py +1 -1
  2. liquid/builtin/expressions/loop.py +2 -5
  3. liquid/builtin/loaders/mixins.py +1 -2
  4. liquid/extra/tags/macro_tag.py +2 -0
  5. liquid/messages.py +1 -1
  6. liquid/static_analysis.py +16 -10
  7. {python_liquid-2.0.0.dist-info → python_liquid-2.0.2.dist-info}/METADATA +6 -9
  8. python_liquid-2.0.2.dist-info/RECORD +95 -0
  9. liquid/golden/__init__.py +0 -173
  10. liquid/golden/abs_filter.py +0 -73
  11. liquid/golden/append_filter.py +0 -43
  12. liquid/golden/assign_tag.py +0 -45
  13. liquid/golden/at_least_filter.py +0 -78
  14. liquid/golden/at_most_filter.py +0 -68
  15. liquid/golden/base64_decode_filter.py +0 -43
  16. liquid/golden/base64_encode_filter.py +0 -42
  17. liquid/golden/base64_url_safe_decode_filter.py +0 -43
  18. liquid/golden/base64_url_safe_encode_filter.py +0 -42
  19. liquid/golden/capitalize_filter.py +0 -27
  20. liquid/golden/capture_tag.py +0 -39
  21. liquid/golden/case.py +0 -28
  22. liquid/golden/case_tag.py +0 -226
  23. liquid/golden/ceil_filter.py +0 -63
  24. liquid/golden/comment_tag.py +0 -119
  25. liquid/golden/compact_filter.py +0 -54
  26. liquid/golden/concat_filter.py +0 -63
  27. liquid/golden/cycle_tag.py +0 -114
  28. liquid/golden/date_filter.py +0 -63
  29. liquid/golden/decrement_tag.py +0 -16
  30. liquid/golden/default_filter.py +0 -112
  31. liquid/golden/divided_by_filter.py +0 -101
  32. liquid/golden/doc_tag.py +0 -61
  33. liquid/golden/downcase_filter.py +0 -27
  34. liquid/golden/echo_tag.py +0 -116
  35. liquid/golden/escape_filter.py +0 -27
  36. liquid/golden/escape_once_filter.py +0 -32
  37. liquid/golden/find_filter.py +0 -90
  38. liquid/golden/find_index_filter.py +0 -96
  39. liquid/golden/first_filter.py +0 -51
  40. liquid/golden/floor_filter.py +0 -63
  41. liquid/golden/for_tag.py +0 -642
  42. liquid/golden/has_filter.py +0 -139
  43. liquid/golden/identifiers.py +0 -249
  44. liquid/golden/if_tag.py +0 -531
  45. liquid/golden/ifchanged_tag.py +0 -46
  46. liquid/golden/illegal.py +0 -34
  47. liquid/golden/include_tag.py +0 -196
  48. liquid/golden/increment_tag.py +0 -48
  49. liquid/golden/inline_comment_tag.py +0 -127
  50. liquid/golden/join_filter.py +0 -69
  51. liquid/golden/last_filter.py +0 -51
  52. liquid/golden/liquid_tag.py +0 -215
  53. liquid/golden/lstrip_filter.py +0 -37
  54. liquid/golden/map_filter.py +0 -50
  55. liquid/golden/minus_filter.py +0 -58
  56. liquid/golden/modulo_filter.py +0 -60
  57. liquid/golden/newline_to_br_filter.py +0 -37
  58. liquid/golden/not_liquid.py +0 -16
  59. liquid/golden/output_statement.py +0 -295
  60. liquid/golden/plus_filter.py +0 -63
  61. liquid/golden/prepend_filter.py +0 -43
  62. liquid/golden/range_objects.py +0 -79
  63. liquid/golden/raw_tag.py +0 -31
  64. liquid/golden/reject_filter.py +0 -268
  65. liquid/golden/remove_filter.py +0 -45
  66. liquid/golden/remove_first_filter.py +0 -46
  67. liquid/golden/remove_last_filter.py +0 -46
  68. liquid/golden/render_tag.py +0 -210
  69. liquid/golden/replace_filter.py +0 -65
  70. liquid/golden/replace_first_filter.py +0 -59
  71. liquid/golden/replace_last_filter.py +0 -60
  72. liquid/golden/reverse_filter.py +0 -42
  73. liquid/golden/round_filter.py +0 -87
  74. liquid/golden/rstrip_filter.py +0 -37
  75. liquid/golden/size_filter.py +0 -42
  76. liquid/golden/slice_filter.py +0 -119
  77. liquid/golden/sort_filter.py +0 -86
  78. liquid/golden/sort_natural_filter.py +0 -105
  79. liquid/golden/special.py +0 -91
  80. liquid/golden/split_filter.py +0 -128
  81. liquid/golden/strip_filter.py +0 -37
  82. liquid/golden/strip_html_filter.py +0 -74
  83. liquid/golden/strip_newlines_filter.py +0 -37
  84. liquid/golden/sum_filter.py +0 -97
  85. liquid/golden/tablerow_tag.py +0 -399
  86. liquid/golden/times_filter.py +0 -53
  87. liquid/golden/truncate_filter.py +0 -61
  88. liquid/golden/truncatewords_filter.py +0 -94
  89. liquid/golden/uniq_filter.py +0 -87
  90. liquid/golden/unless_tag.py +0 -101
  91. liquid/golden/upcase_filter.py +0 -27
  92. liquid/golden/url_decode_filter.py +0 -27
  93. liquid/golden/url_encode_filter.py +0 -27
  94. liquid/golden/where_filter.py +0 -122
  95. liquid/golden/whitespace_control.py +0 -281
  96. python_liquid-2.0.0.dist-info/RECORD +0 -182
  97. {python_liquid-2.0.0.dist-info → python_liquid-2.0.2.dist-info}/WHEEL +0 -0
  98. {python_liquid-2.0.0.dist-info → python_liquid-2.0.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,139 +0,0 @@
1
- """Test cases for the standard `has` filter."""
2
-
3
- from liquid.golden.case import Case
4
-
5
- cases = [
6
- Case(
7
- description="array of strings, default value",
8
- template=r"{{ a | has: 'z' }}",
9
- expect="true",
10
- globals={"a": ["x", "y", "z"]},
11
- ),
12
- Case(
13
- description="array of strings, default value, substring match",
14
- template=r"{{ a | has: 'z' }}",
15
- expect="true",
16
- globals={"a": ["x", "y", "zoo"]},
17
- ),
18
- Case(
19
- description="array of strings, default value, no match",
20
- template=r"{{ a | has: ':(' }}",
21
- expect="false",
22
- globals={"a": ["x", "y", "z"]},
23
- ),
24
- Case(
25
- description="array of ints, default value",
26
- template=r"{{ a | has: 2 }}",
27
- expect="true",
28
- globals={"a": [1, 2, 3]},
29
- ),
30
- Case(
31
- description="array of ints, string argument, default value",
32
- template=r"{{ a | has: '2' }}",
33
- expect="",
34
- globals={"a": [1, 2, 3]},
35
- error=True,
36
- ),
37
- Case(
38
- description="mixed array, default value",
39
- template=r"{{ a | has: 'z' }}",
40
- expect="",
41
- globals={"a": ["x", None, "z", False, True]},
42
- ),
43
- Case(
44
- description="string input, default value, match",
45
- template=r"{{ a | has: 'z' }}",
46
- expect="true",
47
- globals={"a": "zoo"},
48
- ),
49
- Case(
50
- description="string input, default value, no match",
51
- template=r"{{ a | has: 'z' }}",
52
- expect="false",
53
- globals={"a": "foo"},
54
- ),
55
- Case(
56
- description="hash input, default value, match",
57
- template=r"{{ a | has: 'z' }}",
58
- expect="true",
59
- globals={"a": {"z": 42}},
60
- ),
61
- Case(
62
- description="hash input, default value, no match",
63
- template=r"{{ a | has: 'z' }}",
64
- expect="false",
65
- globals={"a": {"x": 42}},
66
- ),
67
- Case(
68
- description="hash input, int value, match",
69
- template=r"{{ a | has: 'z', 42 }}",
70
- expect="true",
71
- globals={"a": {"z": 42}},
72
- ),
73
- Case(
74
- description="hash input, int value, no match",
75
- template=r"{{ a | has: 'z', 99 }}",
76
- expect="false",
77
- globals={"a": {"z": 42}},
78
- ),
79
- Case(
80
- description="hash input, string value, no type coercion",
81
- template=r"{{ a | has: 'z', '42' }}",
82
- expect="false",
83
- globals={"a": {"z": 42}},
84
- ),
85
- Case(
86
- description="hash input, explicit nil, no match",
87
- template=r"{{ a | has: 'z', nil }}",
88
- expect="true",
89
- globals={"a": {"z": 42}},
90
- ),
91
- Case(
92
- description="hash input, explicit nil, match",
93
- template=r"{{ a | has: 'z', nil }}",
94
- expect="false",
95
- globals={"a": {"z": None}},
96
- ),
97
- Case(
98
- description="hash input, false value, match",
99
- template=r"{{ a | has: 'z', false }}",
100
- expect="true",
101
- globals={"a": {"z": False}},
102
- ),
103
- Case(
104
- description="array of hashes, int value, match",
105
- template=r"{{ a | has: 'z', 42 }}",
106
- expect="true",
107
- globals={"a": [{"x": 99}, {"z": 42}]},
108
- ),
109
- Case(
110
- description="array of hashes, int value, no match",
111
- template=r"{{ a | has: 'z', 7 }}",
112
- expect="false",
113
- globals={"a": [{"x": 99}, {"z": 42}]},
114
- ),
115
- Case(
116
- description="array of hashes, with a nil",
117
- template=r"{{ a | has: 'z', 42 }}",
118
- expect="",
119
- globals={"a": [{"x": 99}, None, {"z": 42}]},
120
- ),
121
- Case(
122
- description="array of hashes, nil property",
123
- template=r"{{ a | has: nil }}",
124
- expect="false",
125
- globals={"a": [{"x": 99}, {"z": 42}]},
126
- ),
127
- Case(
128
- description="array of hashes, int property",
129
- template=r"{{ a | has: 42 }}",
130
- expect="false",
131
- globals={"a": [{"x": 99}, {"z": 42}]},
132
- ),
133
- Case(
134
- description="array of hashes, false property",
135
- template=r"{{ a | has: false }}",
136
- expect="false",
137
- globals={"a": [{"x": 99}, {"z": 42}]},
138
- ),
139
- ]
@@ -1,249 +0,0 @@
1
- """Golden test cases for testing liquid identifiers."""
2
-
3
- from liquid.golden.case import Case
4
-
5
- cases = [
6
- Case(
7
- description="ascii lowercase",
8
- template="{% assign foo = 'hello' %}{{ foo }} {{ bar }}",
9
- expect="hello goodbye",
10
- globals={"bar": "goodbye"},
11
- strict=True,
12
- ),
13
- Case(
14
- description="ascii uppercase",
15
- template="{% assign FOO = 'hello' %}{{ FOO }} {{ BAR }}",
16
- expect="hello goodbye",
17
- globals={"BAR": "goodbye"},
18
- strict=True,
19
- ),
20
- Case(
21
- description="digits",
22
- template="{% assign foo1 = 'hello' %}{{ foo1 }} {{ bar2 }}",
23
- expect="hello goodbye",
24
- globals={"bar2": "goodbye"},
25
- strict=True,
26
- ),
27
- Case(
28
- description="only digits",
29
- template="{% assign 123 = 'hello' %}{{ 123 }} {{ 456 }}",
30
- expect="123 456",
31
- globals={"456": "goodbye"},
32
- strict=True,
33
- ),
34
- # Case(
35
- # description="leading digits",
36
- # template="{% assign 1foo = 'hello' %}{{ 1foo }} {{ 2bar }}",
37
- # expect="hello goodbye",
38
- # globals={"2bar": "goodbye"},
39
- # strict=True,
40
- # error=True,
41
- # ),
42
- Case(
43
- description="hyphens",
44
- template="{% assign foo-a = 'hello' %}{{ foo-a }} {{ bar-b }}",
45
- expect="hello goodbye",
46
- globals={"bar-b": "goodbye"},
47
- strict=True,
48
- ),
49
- Case(
50
- description="leading hyphen",
51
- template="{% assign -foo = 'hello' %}{{ -foo }} {{ -bar }}",
52
- expect="hello goodbye",
53
- globals={"-bar": "goodbye"},
54
- strict=True,
55
- error=True,
56
- ),
57
- Case(
58
- description="underscore",
59
- template="{% assign foo_a = 'hello' %}{{ foo_a }} {{ bar_b }}",
60
- expect="hello goodbye",
61
- globals={"bar_b": "goodbye"},
62
- strict=True,
63
- ),
64
- Case(
65
- description="only underscore",
66
- template="{% assign _ = 'hello' %}{{ _ }} {{ __ }}",
67
- expect="hello goodbye",
68
- globals={"__": "goodbye"},
69
- strict=True,
70
- ),
71
- Case(
72
- description="leading underscore",
73
- template="{% assign _foo = 'hello' %}{{ _foo }} {{ _bar }}",
74
- expect="hello goodbye",
75
- globals={"_bar": "goodbye"},
76
- strict=True,
77
- ),
78
- Case(
79
- description="trailing question mark assign",
80
- template="{% assign foo? = 'hello' %}{{ foo? }}",
81
- expect="hello",
82
- strict=True,
83
- error=True,
84
- ),
85
- Case(
86
- description="trailing question mark output",
87
- template="{{ bar? }}",
88
- expect="goodbye",
89
- globals={"bar?": "goodbye"},
90
- strict=True,
91
- error=False,
92
- ),
93
- # Case(
94
- # description="non-trailing question mark output",
95
- # template="{{ fo?o }}",
96
- # expect="hello",
97
- # globals={"fo?o": "hello"},
98
- # strict=True,
99
- # error=True,
100
- # ),
101
- Case(
102
- description="hyphen in for loop target",
103
- template="{% for x in f-oo %}{{ x }}{% endfor %}",
104
- expect="123",
105
- globals={"f-oo": [1, 2, 3]},
106
- strict=True,
107
- ),
108
- Case(
109
- description="leading hyphen in for loop target",
110
- template="{% for x in -foo %}{{ x }}{% endfor %}",
111
- expect="123",
112
- globals={"-foo": [1, 2, 3]},
113
- strict=True,
114
- error=True,
115
- ),
116
- Case(
117
- description="hyphen in for loop variable",
118
- template="{% for x-y in foo %}{{ x-y }}{% endfor %}",
119
- expect="123",
120
- globals={"foo": [1, 2, 3]},
121
- strict=True,
122
- ),
123
- Case(
124
- description="trailing question mark in for loop target",
125
- template="{% for x in foo? %}{{ x }}{% endfor %}",
126
- expect="123",
127
- globals={"foo?": [1, 2, 3]},
128
- strict=True,
129
- ),
130
- Case(
131
- description="trailing question mark in for loop variable",
132
- template="{% for x? in foo %}{{ x? }}{% endfor %}",
133
- expect="123",
134
- globals={"foo": [1, 2, 3]},
135
- strict=True,
136
- ),
137
- Case(
138
- description="increment with a hyphen",
139
- template="{% increment f-oo %}{% increment f-oo %}",
140
- expect="01",
141
- strict=True,
142
- ),
143
- # Case(
144
- # description="increment with a leading hyphen",
145
- # template="{% increment -foo %}{% increment -foo %}",
146
- # expect="01",
147
- # strict=True,
148
- # ),
149
- Case(
150
- description="decrement with a hyphen",
151
- template="{% decrement f-oo %}{% decrement f-oo %}",
152
- expect="-1-2",
153
- strict=True,
154
- ),
155
- # Case(
156
- # description="decrement with a leading hyphen",
157
- # template="{% decrement -foo %}{% decrement -foo %}",
158
- # expect="-1-2",
159
- # strict=True,
160
- # ),
161
- Case(
162
- description="capture ascii lowercase",
163
- template="{% capture foo %}hello{% endcapture %}{{ foo }}",
164
- expect="hello",
165
- strict=True,
166
- ),
167
- Case(
168
- description="capture ascii uppercase",
169
- template="{% capture FOO %}hello{% endcapture %}{{ FOO }}",
170
- expect="hello",
171
- strict=True,
172
- ),
173
- Case(
174
- description="capture digits",
175
- template="{% capture foo1 %}hello{% endcapture %}{{ foo1 }}",
176
- expect="hello",
177
- strict=True,
178
- ),
179
- Case(
180
- description="capture only digits",
181
- template="{% capture 123 %}hello{% endcapture %}{{ 123 }}",
182
- expect="123",
183
- strict=True,
184
- ),
185
- # Case(
186
- # description="capture leading digits",
187
- # template="{% capture 1foo %}hello {{ 2bar }}{% endcapture %}{{ 1foo }}",
188
- # expect="hello goodbye",
189
- # globals={"2bar": "goodbye"},
190
- # strict=True,
191
- # error=True,
192
- # ),
193
- Case(
194
- description="capture hyphens",
195
- template="{% capture foo-a %}hello {{ bar-b }}{% endcapture %}{{ foo-a }}",
196
- expect="hello goodbye",
197
- globals={"bar-b": "goodbye"},
198
- strict=True,
199
- ),
200
- Case(
201
- description="capture leading hyphen",
202
- template="{% capture -foo %}hello {{ -bar }}{% endcapture %}{{ -foo }}",
203
- expect="hello goodbye",
204
- globals={"-bar": "goodbye"},
205
- strict=True,
206
- error=True,
207
- ),
208
- Case(
209
- description="capture underscore",
210
- template="{% capture foo_a %}hello {{ bar_b }}{% endcapture %}{{ foo_a }}",
211
- expect="hello goodbye",
212
- globals={"bar_b": "goodbye"},
213
- strict=True,
214
- ),
215
- Case(
216
- description="capture only underscore",
217
- template="{% capture _ %}hello {{ __ }}{% endcapture %}{{ _ }}",
218
- expect="hello goodbye",
219
- globals={"__": "goodbye"},
220
- strict=True,
221
- ),
222
- Case(
223
- description="capture leading underscore",
224
- template="{% capture _foo %}hello {{ _bar }}{% endcapture %}{{ _foo }}",
225
- expect="hello goodbye",
226
- globals={"_bar": "goodbye"},
227
- strict=True,
228
- ),
229
- # Case(
230
- # description="capture trailing question mark",
231
- # template="{% capture foo? %}hello{% endcapture %}{{ foo? }}",
232
- # expect="",
233
- # strict=True,
234
- # ),
235
- Case(
236
- description="at sign",
237
- template="{{ @foo }}",
238
- expect="hello",
239
- globals={"@foo": "hello"},
240
- strict=True,
241
- error=True,
242
- ),
243
- # Case(
244
- # description="assign at sign",
245
- # template="{% assign @foo = 'hello' %}",
246
- # expect="",
247
- # strict=True,
248
- # ),
249
- ]