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,215 +0,0 @@
1
- """Golden tests cases for testing liquid's `liquid` tag."""
2
-
3
- from liquid.golden.case import Case
4
-
5
- cases = [
6
- Case(
7
- description="newline terminated tags",
8
- template="\n".join(
9
- [
10
- r"{% liquid",
11
- r"if product.title",
12
- r" echo product.title | upcase",
13
- r"else",
14
- r" echo 'product-1' | upcase ",
15
- r"endif",
16
- r"",
17
- r"for i in (0..5)",
18
- r" echo i",
19
- r"endfor %}",
20
- ]
21
- ),
22
- expect="FOO012345",
23
- globals={"product": {"title": "foo"}},
24
- ),
25
- Case(
26
- description="carriage return and newline terminated tags",
27
- template="\r\n".join(
28
- [
29
- r"{% liquid",
30
- r"if product.title",
31
- r" echo product.title | upcase",
32
- r"else",
33
- r" echo 'product-1' | upcase ",
34
- r"endif",
35
- r"",
36
- r"for i in (0..5)",
37
- r" echo i",
38
- r"endfor %}",
39
- ]
40
- ),
41
- expect="FOO012345",
42
- globals={"product": {"title": "foo"}},
43
- ),
44
- Case(
45
- description="carriage return terminated tags",
46
- template="\r".join(
47
- [
48
- r"{% liquid",
49
- r"if product.title",
50
- r" echo product.title | upcase",
51
- r"else",
52
- r" echo 'product-1' | upcase ",
53
- r"endif",
54
- r"",
55
- r"for i in (0..5)",
56
- r" echo i",
57
- r"endfor %}",
58
- ]
59
- ),
60
- expect="",
61
- globals={"product": {"title": "foo"}},
62
- error=True,
63
- ),
64
- Case(
65
- description="empty liquid tag",
66
- template=r"{% liquid %}",
67
- expect="",
68
- ),
69
- Case(
70
- description="only whitespace",
71
- template="{% liquid\n \n\n \t \n\t\n %}",
72
- expect="",
73
- ),
74
- Case(
75
- description="single line comment tag",
76
- template="\n".join(
77
- [
78
- r"{% liquid",
79
- r"comment this is a comment",
80
- r"endcomment",
81
- r"%}",
82
- ]
83
- ),
84
- expect="",
85
- ),
86
- Case(
87
- description="multi-line comment tag",
88
- template="\n".join(
89
- [
90
- r"{% liquid",
91
- r"comment this is a comment",
92
- r"split over two lines",
93
- r"endcomment",
94
- r"%}",
95
- ]
96
- ),
97
- expect="",
98
- ),
99
- Case(
100
- description="whitespace control",
101
- template="\n".join(
102
- [
103
- r"Hello, ",
104
- r"{%- liquid",
105
- r" echo ' World! '",
106
- r"-%}",
107
- r" Goodbye.",
108
- ]
109
- ),
110
- expect="Hello, World! Goodbye.",
111
- ),
112
- Case(
113
- description="reference test #2",
114
- template="\n".join(
115
- [
116
- r"{%- liquid",
117
- r" for value in array",
118
- r" echo value",
119
- r" unless forloop.last",
120
- r" echo '#'",
121
- r" endunless",
122
- r" endfor",
123
- r"-%}",
124
- ]
125
- ),
126
- expect="1#2#3",
127
- globals={"array": [1, 2, 3]},
128
- ),
129
- Case(
130
- description="reference test #3",
131
- template="\n".join(
132
- [
133
- r"{%- liquid",
134
- r" for value in array",
135
- r" assign double_value = value | times: 2",
136
- r" echo double_value | times: 2",
137
- r" unless forloop.last",
138
- r" echo '#'",
139
- r" endunless",
140
- r" endfor",
141
- r"",
142
- r" echo '#'",
143
- r" echo double_value",
144
- r"-%}",
145
- ]
146
- ),
147
- expect="4#8#12#6",
148
- globals={"array": [1, 2, 3]},
149
- ),
150
- Case(
151
- description="reference test #4",
152
- template="\n".join(
153
- [
154
- r"{%- liquid echo 'a' -%}",
155
- r"b",
156
- r"{%- liquid echo 'c' -%}",
157
- ]
158
- ),
159
- expect="abc",
160
- ),
161
- Case(
162
- description="nested liquid",
163
- template="\n".join(
164
- [
165
- r"{%- if true %}",
166
- r" {%- liquid",
167
- r' echo "good"',
168
- r" %}",
169
- r"{%- endif -%}",
170
- ]
171
- ),
172
- expect="good",
173
- ),
174
- Case(
175
- description="can't close nested blocks",
176
- template="\n".join(
177
- [
178
- r"{%- if true -%}",
179
- r"42",
180
- r"{%- liquid endif -%}",
181
- ]
182
- ),
183
- expect="",
184
- error=True,
185
- ),
186
- Case(
187
- description="bare liquid tag in liquid tag",
188
- template="\n".join(
189
- [
190
- r"{%- liquid",
191
- r" liquid",
192
- r' echo "foo"',
193
- r"-%}",
194
- ]
195
- ),
196
- expect="foo",
197
- ),
198
- Case(
199
- description="liquid tag in liquid tag",
200
- template="\n".join(
201
- [
202
- r"{%- liquid",
203
- r" liquid echo 'bar'",
204
- r' echo "foo"',
205
- r"-%}",
206
- ]
207
- ),
208
- expect="barfoo",
209
- ),
210
- Case(
211
- description="nested liquid in liquid tag",
212
- template='{%- liquid liquid liquid echo "foo" -%}',
213
- expect="foo",
214
- ),
215
- ]
@@ -1,37 +0,0 @@
1
- """Golden tests cases for testing liquid's built-in `lstrip` filter."""
2
-
3
- from liquid.golden.case import Case
4
-
5
- cases = [
6
- Case(
7
- description="left padded",
8
- template='{{ " \t\r\n hello" | lstrip }}',
9
- expect="hello",
10
- ),
11
- Case(
12
- description="right padded",
13
- template='{{ "hello \t\r\n " | lstrip }}',
14
- expect="hello \t\r\n ",
15
- ),
16
- Case(
17
- description="left and right padded",
18
- template='{{ " \t\r\n hello \t\r\n " | lstrip }}',
19
- expect="hello \t\r\n ",
20
- ),
21
- Case(
22
- description="not a string",
23
- template=r"{{ 5 | lstrip }}",
24
- expect="5",
25
- ),
26
- Case(
27
- description="unexpected argument",
28
- template=r'{{ "hello" | lstrip: 5 }}',
29
- expect="",
30
- error=True,
31
- ),
32
- Case(
33
- description="undefined left value",
34
- template=r"{{ nosuchthing | lstrip }}",
35
- expect="",
36
- ),
37
- ]
@@ -1,50 +0,0 @@
1
- """Golden tests cases for testing liquid's built-in `map` filter."""
2
-
3
- from liquid.golden.case import Case
4
-
5
- cases = [
6
- Case(
7
- description="array of objects",
8
- template=r"{{ a | map: 'title' | join: '#' }}",
9
- expect="foo#bar#baz",
10
- globals={"a": [{"title": "foo"}, {"title": "bar"}, {"title": "baz"}]},
11
- ),
12
- Case(
13
- description="missing property",
14
- template=r"{{ a | map: 'title' | join: '#' }}",
15
- expect="foo#bar#",
16
- globals={"a": [{"title": "foo"}, {"title": "bar"}, {"heading": "baz"}]},
17
- ),
18
- Case(
19
- description="left value not an array",
20
- template=r"{{ a | map: 'title' | join: '#' }}",
21
- expect="",
22
- globals={"a": 123},
23
- error=True,
24
- ),
25
- Case(
26
- description="array containing a non object",
27
- template=r"{{ a | map: 'title' | join: '#' }}",
28
- expect="",
29
- globals={"a": [{"title": "foo"}, {"title": "bar"}, 5, []]},
30
- error=True,
31
- ),
32
- Case(
33
- description="undefined argument",
34
- template=r"{{ a | map: nosuchthing | join: '#' }}",
35
- expect="#",
36
- globals={"a": [{"title": "foo"}, {"title": "bar"}]},
37
- ),
38
- Case(
39
- description="nested arrays get flattened",
40
- template=r"{{ a | map: 'title' | join: '#' }}",
41
- expect="foo#bar#baz",
42
- globals={"a": [{"title": "foo"}, [{"title": "bar"}, {"title": "baz"}]]},
43
- ),
44
- Case(
45
- description="input is a hash",
46
- template=r"{{ a | map: 'title' | join: '#' }}",
47
- expect="foo",
48
- globals={"a": {"title": "foo", "some": "thing"}},
49
- ),
50
- ]
@@ -1,58 +0,0 @@
1
- """Golden tests cases for testing liquid's built-in `minus` filter."""
2
-
3
- from liquid.golden.case import Case
4
-
5
- cases = [
6
- Case(
7
- description="integer value and integer arg",
8
- template=r"{{ 10 | minus: 2 }}",
9
- expect="8",
10
- ),
11
- Case(
12
- description="integer value and float arg",
13
- template=r"{{ 10 | minus: 2.0 }}",
14
- expect="8.0",
15
- ),
16
- Case(
17
- description="float value and float arg",
18
- template=r"{{ 10.1 | minus: 2.2 }}",
19
- expect="7.9",
20
- ),
21
- Case(
22
- description="string value and string arg",
23
- template=r'{{ "10.1" | minus: "2.2" }}',
24
- expect="7.9",
25
- ),
26
- Case(
27
- description="string not a number",
28
- template=r'{{ "foo" | minus: "2.0" }}',
29
- expect="-2.0",
30
- ),
31
- Case(
32
- description="arg string not a number",
33
- template=r'{{ "10" | minus: "foo" }}',
34
- expect="10",
35
- ),
36
- Case(
37
- description="too many args",
38
- template=r"{{ 5 | minus: 1, '5' }}",
39
- expect="",
40
- error=True,
41
- ),
42
- Case(
43
- description="not a string, int or float",
44
- template=r"{{ a | minus: 1 }}",
45
- expect="-1",
46
- globals={"a": {}},
47
- ),
48
- Case(
49
- description="undefined left value",
50
- template=r"{{ nosuchthing | minus: 2 }}",
51
- expect="-2",
52
- ),
53
- Case(
54
- description="undefined argument",
55
- template=r"{{ 10 | minus: nosuchthing }}",
56
- expect="10",
57
- ),
58
- ]
@@ -1,60 +0,0 @@
1
- """Golden tests cases for testing liquid's built-in `modulo` filter."""
2
-
3
- from liquid.golden.case import Case
4
-
5
- cases = [
6
- Case(
7
- description="integer value and integer arg",
8
- template=r"{{ 10 | modulo: 2 }}",
9
- expect="0",
10
- ),
11
- Case(
12
- description="integer value and float arg",
13
- template=r"{{ 10 | modulo: 2.0 }}",
14
- expect="0.0",
15
- ),
16
- Case(
17
- description="float value and float arg",
18
- template=r"{{ 10.1 | modulo: 7.0 }}",
19
- expect="3.1",
20
- ),
21
- Case(
22
- description="string value and argument",
23
- template=r'{{ "10" | modulo: "2.0" }}',
24
- expect="0.0",
25
- ),
26
- Case(
27
- description="string not a number",
28
- template=r'{{ "foo" | modulo: "2.0" }}',
29
- expect="0.0",
30
- ),
31
- Case(
32
- description="arg string not a number",
33
- template=r'{{ "10" | modulo: "foo" }}',
34
- expect="",
35
- error=True,
36
- ),
37
- Case(
38
- description="too many args",
39
- template=r"{{ 5 | modulo: 1, '5' }}",
40
- expect="",
41
- error=True,
42
- ),
43
- Case(
44
- description="not a string, int or float",
45
- template=r"{{ a | modulo: 1 }}",
46
- expect="0",
47
- globals={"a": {}},
48
- ),
49
- Case(
50
- description="undefined left value",
51
- template=r"{{ nosuchthing | modulo: 2 }}",
52
- expect="0",
53
- ),
54
- Case(
55
- description="undefined argument",
56
- template=r"{{ 5 | modulo: nosuchthing }}",
57
- expect="",
58
- error=True,
59
- ),
60
- ]
@@ -1,37 +0,0 @@
1
- """Golden tests cases for testing liquid's built-in `newline_to_br` filter."""
2
-
3
- from liquid.golden.case import Case
4
-
5
- cases = [
6
- Case(
7
- description="string with newlines",
8
- template='{{ "- apples\n- oranges\n" | newline_to_br }}',
9
- expect="- apples<br />\n- oranges<br />\n",
10
- ),
11
- Case(
12
- description="not a string",
13
- template="{{ 5 | newline_to_br }}",
14
- expect="5",
15
- ),
16
- Case(
17
- description="unexpected argument",
18
- template='{{ "hello" | newline_to_br: 5 }}',
19
- expect="",
20
- error=True,
21
- ),
22
- Case(
23
- description="reference implementation test 1",
24
- template='{{ "a\nb\nc" | newline_to_br }}',
25
- expect="a<br />\nb<br />\nc",
26
- ),
27
- Case(
28
- description="reference implementation test 2",
29
- template='{{ "a\r\nb\nc" | newline_to_br }}',
30
- expect="a<br />\nb<br />\nc",
31
- ),
32
- Case(
33
- description="undefined left value",
34
- template="{{ nosuchthing | newline_to_br }}",
35
- expect="",
36
- ),
37
- ]
@@ -1,16 +0,0 @@
1
- """Golden tests cases for testing text that is not liquid."""
2
-
3
- from liquid.golden.case import Case
4
-
5
- cases = [
6
- Case(
7
- description="plain text gets passed through unchanged",
8
- template="a literal string",
9
- expect="a literal string",
10
- ),
11
- Case(
12
- description="css text gets passed through unchanged",
13
- template=" div { font-weight: bold; } ",
14
- expect=" div { font-weight: bold; } ",
15
- ),
16
- ]