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/at_most_filter.py
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `at_most` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="positive integer < arg",
|
|
8
|
-
template=r"{{ 5 | at_most: 8 }}",
|
|
9
|
-
expect="5",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="positive integer > arg",
|
|
13
|
-
template=r"{{ 8 | at_most: 5 }}",
|
|
14
|
-
expect="5",
|
|
15
|
-
),
|
|
16
|
-
Case(
|
|
17
|
-
description="negative integer < arg",
|
|
18
|
-
template=r"{{ -8 | at_most: 5 }}",
|
|
19
|
-
expect="-8",
|
|
20
|
-
),
|
|
21
|
-
Case(
|
|
22
|
-
description="positive integer == arg",
|
|
23
|
-
template=r"{{ 5 | at_most: 5 }}",
|
|
24
|
-
expect="5",
|
|
25
|
-
),
|
|
26
|
-
Case(
|
|
27
|
-
description="positive float < arg",
|
|
28
|
-
template=r"{{ 5.4 | at_most: 8.9 }}",
|
|
29
|
-
expect="5.4",
|
|
30
|
-
),
|
|
31
|
-
Case(
|
|
32
|
-
description="positive float > arg",
|
|
33
|
-
template=r"{{ 8.4 | at_most: 5.9 }}",
|
|
34
|
-
expect="5.9",
|
|
35
|
-
),
|
|
36
|
-
Case(
|
|
37
|
-
description="positive string > arg",
|
|
38
|
-
template=r'{{ "9" | at_most: 8 }}',
|
|
39
|
-
expect="8",
|
|
40
|
-
),
|
|
41
|
-
Case(
|
|
42
|
-
description="missing arg",
|
|
43
|
-
template=r"{{ 5 | at_most }}",
|
|
44
|
-
expect="",
|
|
45
|
-
error=True,
|
|
46
|
-
),
|
|
47
|
-
Case(
|
|
48
|
-
description="too many args",
|
|
49
|
-
template=r"{{ 5 | at_most: 1, 2}}",
|
|
50
|
-
expect="",
|
|
51
|
-
error=True,
|
|
52
|
-
),
|
|
53
|
-
Case(
|
|
54
|
-
description="undefined left value",
|
|
55
|
-
template=r"{{ nosuchthing | at_most: 5 }}",
|
|
56
|
-
expect="0",
|
|
57
|
-
),
|
|
58
|
-
Case(
|
|
59
|
-
description="undefined argument",
|
|
60
|
-
template=r"{{ 5 | at_most: nosuchthing }}",
|
|
61
|
-
expect="0",
|
|
62
|
-
),
|
|
63
|
-
Case(
|
|
64
|
-
description="left value not a number",
|
|
65
|
-
template=r'{{ "abc" | at_most: -2 }}',
|
|
66
|
-
expect="-2",
|
|
67
|
-
),
|
|
68
|
-
]
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `base64_decode` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="from string",
|
|
8
|
-
template=r'{{ "XyMvLg==" | base64_decode }}',
|
|
9
|
-
expect="_#/.",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="from string with URL unsafe",
|
|
13
|
-
template=r"{{ a | base64_decode }}",
|
|
14
|
-
expect=(
|
|
15
|
-
r"abcdefghijklmnopqrstuvwxyz "
|
|
16
|
-
r"ABCDEFGHIJKLMNOPQRSTUVWXYZ "
|
|
17
|
-
r"1234567890 !@#$%^&*()-=_+/?.:;[]{}\|"
|
|
18
|
-
),
|
|
19
|
-
globals={
|
|
20
|
-
"a": (
|
|
21
|
-
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXogQUJDREVGR0hJSktMTU5PUFFSU1RVV"
|
|
22
|
-
"ldYWVogMTIzNDU2Nzg5MCAhQCMkJV4mKigpLT1fKy8/Ljo7W117fVx8"
|
|
23
|
-
)
|
|
24
|
-
},
|
|
25
|
-
),
|
|
26
|
-
Case(
|
|
27
|
-
description="not a string",
|
|
28
|
-
template=r"{{ 5 | base64_decode }}",
|
|
29
|
-
expect="",
|
|
30
|
-
error=True,
|
|
31
|
-
),
|
|
32
|
-
Case(
|
|
33
|
-
description="unexpected argument",
|
|
34
|
-
template=r'{{ "hello" | base64_decode: 5 }}',
|
|
35
|
-
expect="",
|
|
36
|
-
error=True,
|
|
37
|
-
),
|
|
38
|
-
Case(
|
|
39
|
-
description="undefined left value",
|
|
40
|
-
template=r"{{ nosuchthing | base64_decode }}",
|
|
41
|
-
expect="",
|
|
42
|
-
),
|
|
43
|
-
]
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `base64_encode` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="from string",
|
|
8
|
-
template=r'{{ "_#/." | base64_encode }}',
|
|
9
|
-
expect="XyMvLg==",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="from string with URL unsafe",
|
|
13
|
-
template=r"{{ a | base64_encode }}",
|
|
14
|
-
expect=(
|
|
15
|
-
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXogQUJDREVGR0hJSktMTU5PUFFSU1RVV"
|
|
16
|
-
"ldYWVogMTIzNDU2Nzg5MCAhQCMkJV4mKigpLT1fKy8/Ljo7W117fVx8"
|
|
17
|
-
),
|
|
18
|
-
globals={
|
|
19
|
-
"a": (
|
|
20
|
-
r"abcdefghijklmnopqrstuvwxyz "
|
|
21
|
-
r"ABCDEFGHIJKLMNOPQRSTUVWXYZ "
|
|
22
|
-
r"1234567890 !@#$%^&*()-=_+/?.:;[]{}\|"
|
|
23
|
-
)
|
|
24
|
-
},
|
|
25
|
-
),
|
|
26
|
-
Case(
|
|
27
|
-
description="not a string",
|
|
28
|
-
template=r"{{ 5 | base64_encode }}",
|
|
29
|
-
expect="NQ==",
|
|
30
|
-
),
|
|
31
|
-
Case(
|
|
32
|
-
description="unexpected argument",
|
|
33
|
-
template=r'{{ "hello" | base64_encode: 5 }}',
|
|
34
|
-
expect="",
|
|
35
|
-
error=True,
|
|
36
|
-
),
|
|
37
|
-
Case(
|
|
38
|
-
description="undefined left value",
|
|
39
|
-
template=r"{{ nosuchthing | base64_encode }}",
|
|
40
|
-
expect="",
|
|
41
|
-
),
|
|
42
|
-
]
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `base64_url_safe_decode` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="from string",
|
|
8
|
-
template=r'{{ "XyMvLg==" | base64_url_safe_decode }}',
|
|
9
|
-
expect="_#/.",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="from string with URL unsafe",
|
|
13
|
-
template=r"{{ a | base64_url_safe_decode }}",
|
|
14
|
-
expect=(
|
|
15
|
-
r"abcdefghijklmnopqrstuvwxyz "
|
|
16
|
-
r"ABCDEFGHIJKLMNOPQRSTUVWXYZ "
|
|
17
|
-
r"1234567890 !@#$%^&*()-=_+/?.:;[]{}\|"
|
|
18
|
-
),
|
|
19
|
-
globals={
|
|
20
|
-
"a": (
|
|
21
|
-
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXogQUJDREVGR0hJSktMTU5PUFFSU1RVV"
|
|
22
|
-
"ldYWVogMTIzNDU2Nzg5MCAhQCMkJV4mKigpLT1fKy8_Ljo7W117fVx8"
|
|
23
|
-
)
|
|
24
|
-
},
|
|
25
|
-
),
|
|
26
|
-
Case(
|
|
27
|
-
description="not a string",
|
|
28
|
-
template=r"{{ 5 | base64_url_safe_decode }}",
|
|
29
|
-
expect="",
|
|
30
|
-
error=True,
|
|
31
|
-
),
|
|
32
|
-
Case(
|
|
33
|
-
description="unexpected argument",
|
|
34
|
-
template=r'{{ "hello" | base64_url_safe_decode: 5 }}',
|
|
35
|
-
expect="",
|
|
36
|
-
error=True,
|
|
37
|
-
),
|
|
38
|
-
Case(
|
|
39
|
-
description="undefined left value",
|
|
40
|
-
template=r"{{ nosuchthing | base64_url_safe_decode }}",
|
|
41
|
-
expect="",
|
|
42
|
-
),
|
|
43
|
-
]
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `base64_url_safe_encode` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="from string",
|
|
8
|
-
template='{{ "_#/." | base64_url_safe_encode }}',
|
|
9
|
-
expect="XyMvLg==",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="from string with URL unsafe",
|
|
13
|
-
template=r"{{ a | base64_url_safe_encode }}",
|
|
14
|
-
globals={
|
|
15
|
-
"a": (
|
|
16
|
-
r"abcdefghijklmnopqrstuvwxyz "
|
|
17
|
-
r"ABCDEFGHIJKLMNOPQRSTUVWXYZ "
|
|
18
|
-
r"1234567890 !@#$%^&*()-=_+/?.:;[]{}\|"
|
|
19
|
-
)
|
|
20
|
-
},
|
|
21
|
-
expect=(
|
|
22
|
-
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXogQUJDREVGR0hJSktMTU5PUFFSU1RVV"
|
|
23
|
-
"ldYWVogMTIzNDU2Nzg5MCAhQCMkJV4mKigpLT1fKy8_Ljo7W117fVx8"
|
|
24
|
-
),
|
|
25
|
-
),
|
|
26
|
-
Case(
|
|
27
|
-
description="not a string",
|
|
28
|
-
template=r"{{ 5 | base64_url_safe_encode }}",
|
|
29
|
-
expect="NQ==",
|
|
30
|
-
),
|
|
31
|
-
Case(
|
|
32
|
-
description="unexpected argument",
|
|
33
|
-
template=r'{{ "hello" | base64_url_safe_encode: 5 }}',
|
|
34
|
-
expect="",
|
|
35
|
-
error=True,
|
|
36
|
-
),
|
|
37
|
-
Case(
|
|
38
|
-
description="undefined left value",
|
|
39
|
-
template=r"{{ nosuchthing | base64_url_safe_encode }}",
|
|
40
|
-
expect="",
|
|
41
|
-
),
|
|
42
|
-
]
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `capitalize` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="lower case string",
|
|
8
|
-
template=r'{{ "hello" | capitalize }}',
|
|
9
|
-
expect="Hello",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="already capitalized string",
|
|
13
|
-
template=r'{{ "Hello" | capitalize }}',
|
|
14
|
-
expect="Hello",
|
|
15
|
-
),
|
|
16
|
-
Case(
|
|
17
|
-
description="unexpected argument",
|
|
18
|
-
template=r'{{ "hello" | capitalize: 2 }}',
|
|
19
|
-
expect="",
|
|
20
|
-
error=True,
|
|
21
|
-
),
|
|
22
|
-
Case(
|
|
23
|
-
description="undefined left value",
|
|
24
|
-
template=r"{{ nosuchthing | capitalize }}",
|
|
25
|
-
expect="",
|
|
26
|
-
),
|
|
27
|
-
]
|
liquid/golden/capture_tag.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's `capture` tag."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="capture template literal and global variable",
|
|
8
|
-
template=(
|
|
9
|
-
r"{% capture greeting %}"
|
|
10
|
-
r"Hello, {{ customer.first_name }}."
|
|
11
|
-
r"{% endcapture %}"
|
|
12
|
-
r"{{ greeting }}"
|
|
13
|
-
),
|
|
14
|
-
expect="Hello, Holly.",
|
|
15
|
-
globals={"customer": {"first_name": "Holly"}},
|
|
16
|
-
),
|
|
17
|
-
Case(
|
|
18
|
-
description="capture into a variable with a hyphen",
|
|
19
|
-
template=(
|
|
20
|
-
r"{% capture this-thing %}"
|
|
21
|
-
r"Hello, {{ customer.first_name }}."
|
|
22
|
-
r"{% endcapture %}"
|
|
23
|
-
r"{{ this-thing }}"
|
|
24
|
-
),
|
|
25
|
-
expect="Hello, Holly.",
|
|
26
|
-
globals={"customer": {"first_name": "Holly"}},
|
|
27
|
-
),
|
|
28
|
-
Case(
|
|
29
|
-
description="assign to a variable from a captured variable",
|
|
30
|
-
template=(
|
|
31
|
-
r"{% capture some %}"
|
|
32
|
-
r"hello"
|
|
33
|
-
r"{% endcapture %}"
|
|
34
|
-
r"{% assign other = some %}"
|
|
35
|
-
r"{{ some }}-{{ other }}"
|
|
36
|
-
),
|
|
37
|
-
expect="hello-hello",
|
|
38
|
-
),
|
|
39
|
-
]
|
liquid/golden/case.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"""Golden test case definition."""
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from dataclasses import field
|
|
5
|
-
from typing import Any
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@dataclass
|
|
9
|
-
class Case:
|
|
10
|
-
"""Test case dataclass to help with table driven tests."""
|
|
11
|
-
|
|
12
|
-
description: str
|
|
13
|
-
template: str
|
|
14
|
-
expect: str
|
|
15
|
-
globals: dict[str, Any] = field(default_factory=dict) # noqa: A003
|
|
16
|
-
partials: dict[str, Any] = field(default_factory=dict)
|
|
17
|
-
standard: bool = True
|
|
18
|
-
error: bool = False
|
|
19
|
-
strict: bool = False
|
|
20
|
-
future: bool = False
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
TEMPLATE_DROP_ATTRS = (
|
|
24
|
-
r"{{ template }} "
|
|
25
|
-
r"{{ template.directory }} "
|
|
26
|
-
r"{{ template.name }} "
|
|
27
|
-
r"{{ template.suffix }}"
|
|
28
|
-
)
|
liquid/golden/case_tag.py
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's `case` tag."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="simple case/when",
|
|
8
|
-
template=(
|
|
9
|
-
r"{% case title %}"
|
|
10
|
-
r"{% when 'foo' %}foo"
|
|
11
|
-
r"{% when 'Hello' %}bar"
|
|
12
|
-
r"{% endcase %}"
|
|
13
|
-
),
|
|
14
|
-
expect="bar",
|
|
15
|
-
globals={"title": "Hello"},
|
|
16
|
-
),
|
|
17
|
-
Case(
|
|
18
|
-
description="'when' expression using an identifier",
|
|
19
|
-
template=(
|
|
20
|
-
r"{% case title %}"
|
|
21
|
-
r"{% when other %}foo"
|
|
22
|
-
r"{% when 'goodbye' %}bar"
|
|
23
|
-
r"{% endcase %}"
|
|
24
|
-
),
|
|
25
|
-
expect="foo",
|
|
26
|
-
globals={"title": "Hello", "other": "Hello"},
|
|
27
|
-
),
|
|
28
|
-
Case(
|
|
29
|
-
description="tags inside when block",
|
|
30
|
-
template=(
|
|
31
|
-
r"{% case title %}"
|
|
32
|
-
r"{% when other %}"
|
|
33
|
-
r"{% if true %}foo{% endif %}"
|
|
34
|
-
r"{% when 'goodbye' %}bar"
|
|
35
|
-
r"{% endcase %}"
|
|
36
|
-
),
|
|
37
|
-
expect="foo",
|
|
38
|
-
globals={"title": "Hello", "other": "Hello"},
|
|
39
|
-
),
|
|
40
|
-
Case(
|
|
41
|
-
description="'when' expression using an out of scope identifier",
|
|
42
|
-
template=(
|
|
43
|
-
r"{% case title %}"
|
|
44
|
-
r"{% when nosuchthing %}foo"
|
|
45
|
-
r"{% when 'Hello' %}bar"
|
|
46
|
-
r"{% endcase %}"
|
|
47
|
-
),
|
|
48
|
-
expect="bar",
|
|
49
|
-
globals={"title": "Hello"},
|
|
50
|
-
),
|
|
51
|
-
Case(
|
|
52
|
-
description="name not in scope",
|
|
53
|
-
template=(
|
|
54
|
-
r"{% case nosuchthing %}"
|
|
55
|
-
r"{% when 'foo' %}foo"
|
|
56
|
-
r"{% when 'bar' %}bar"
|
|
57
|
-
r"{% endcase %}"
|
|
58
|
-
),
|
|
59
|
-
expect="",
|
|
60
|
-
),
|
|
61
|
-
Case(
|
|
62
|
-
description="no match and no default",
|
|
63
|
-
template=(
|
|
64
|
-
r"{% case title %}"
|
|
65
|
-
r"{% when 'foo' %}foo"
|
|
66
|
-
r"{% when 'bar' %}bar"
|
|
67
|
-
r"{% endcase %}"
|
|
68
|
-
),
|
|
69
|
-
expect="",
|
|
70
|
-
globals={"title": "Hello"},
|
|
71
|
-
),
|
|
72
|
-
Case(
|
|
73
|
-
description="with default",
|
|
74
|
-
template=r"{% case title %}{% when 'foo' %}foo{% else %}bar{% endcase %}",
|
|
75
|
-
expect="bar",
|
|
76
|
-
globals={"title": "Hello"},
|
|
77
|
-
),
|
|
78
|
-
Case(
|
|
79
|
-
description="no whens",
|
|
80
|
-
template=r"{% case title %}{% else %}bar{% endcase %}",
|
|
81
|
-
expect="bar",
|
|
82
|
-
globals={"title": "Hello"},
|
|
83
|
-
),
|
|
84
|
-
Case(
|
|
85
|
-
description="no whens or default",
|
|
86
|
-
template=r"{% case title %}{% endcase %}",
|
|
87
|
-
expect="",
|
|
88
|
-
globals={"title": "Hello"},
|
|
89
|
-
),
|
|
90
|
-
Case(
|
|
91
|
-
description="whitespace",
|
|
92
|
-
template=(
|
|
93
|
-
"{% case title %} \n\t"
|
|
94
|
-
"{% when 'foo' %}foo\n"
|
|
95
|
-
"{% when 'Hello' %}bar"
|
|
96
|
-
"{% endcase %}"
|
|
97
|
-
),
|
|
98
|
-
expect="bar",
|
|
99
|
-
globals={"title": "Hello"},
|
|
100
|
-
),
|
|
101
|
-
Case(
|
|
102
|
-
description="comma separated when expression",
|
|
103
|
-
template=(
|
|
104
|
-
r"{% case title %}"
|
|
105
|
-
r"{% when 'foo' %}foo"
|
|
106
|
-
r"{% when 'bar', 'Hello' %}bar"
|
|
107
|
-
r"{% endcase %}"
|
|
108
|
-
),
|
|
109
|
-
expect="bar",
|
|
110
|
-
globals={"title": "Hello"},
|
|
111
|
-
),
|
|
112
|
-
Case(
|
|
113
|
-
description="evaluate multiple matching blocks",
|
|
114
|
-
template=(
|
|
115
|
-
r"{% case title %}"
|
|
116
|
-
r"{% when 'Hello' %}foo"
|
|
117
|
-
r"{% when a, 'Hello' %}bar"
|
|
118
|
-
r"{% endcase %}"
|
|
119
|
-
),
|
|
120
|
-
expect="foobarbar",
|
|
121
|
-
globals={"title": "Hello", "a": "Hello"},
|
|
122
|
-
),
|
|
123
|
-
Case(
|
|
124
|
-
description="or separated when expression",
|
|
125
|
-
template=(
|
|
126
|
-
r"{% case title %}"
|
|
127
|
-
r"{% when 'foo' %}foo"
|
|
128
|
-
r"{% when 'bar' or 'Hello' %}bar"
|
|
129
|
-
r"{% endcase %}"
|
|
130
|
-
),
|
|
131
|
-
expect="bar",
|
|
132
|
-
globals={"title": "Hello"},
|
|
133
|
-
),
|
|
134
|
-
Case(
|
|
135
|
-
description="mix or and comma separated when expression",
|
|
136
|
-
template=(
|
|
137
|
-
r"{% case title %}"
|
|
138
|
-
r"{% when 'foo' %}foo"
|
|
139
|
-
r"{% when 'bar' or 'Hello', 'Hello' %}bar"
|
|
140
|
-
r"{% endcase %}"
|
|
141
|
-
),
|
|
142
|
-
expect="barbar",
|
|
143
|
-
globals={"title": "Hello"},
|
|
144
|
-
),
|
|
145
|
-
Case(
|
|
146
|
-
description="unexpected when token",
|
|
147
|
-
template=(
|
|
148
|
-
r"{% case title %}"
|
|
149
|
-
r"{% when 'foo' %}foo"
|
|
150
|
-
r"{% when 'bar' and 'Hello', 'Hello' %}bar"
|
|
151
|
-
r"{% endcase %}"
|
|
152
|
-
),
|
|
153
|
-
expect="",
|
|
154
|
-
globals={"title": "Hello"},
|
|
155
|
-
),
|
|
156
|
-
Case(
|
|
157
|
-
description="comma string literal",
|
|
158
|
-
template=(
|
|
159
|
-
r"{% case foo %}"
|
|
160
|
-
r"{% when 'foo' %}bar"
|
|
161
|
-
r"{% when ',' %}comma"
|
|
162
|
-
r"{% endcase %}"
|
|
163
|
-
),
|
|
164
|
-
expect="comma",
|
|
165
|
-
globals={"foo": ","},
|
|
166
|
-
),
|
|
167
|
-
Case(
|
|
168
|
-
description="empty when tag",
|
|
169
|
-
template=(r"{% case foo %}{% when %}bar{% endcase %}"),
|
|
170
|
-
expect="",
|
|
171
|
-
globals={"foo": "bar"},
|
|
172
|
-
error=True,
|
|
173
|
-
),
|
|
174
|
-
Case(
|
|
175
|
-
description="switch on array",
|
|
176
|
-
template="{% case x %}{% when y %}foo{% endcase %}",
|
|
177
|
-
expect="foo",
|
|
178
|
-
globals={"x": ["a", "b", "c"], "y": ["a", "b", "c"]},
|
|
179
|
-
),
|
|
180
|
-
Case(
|
|
181
|
-
description="multiple else blocks",
|
|
182
|
-
template=(
|
|
183
|
-
r"{% case 'x' %}{% when 'y' %}foo{% else %}bar{% else %}baz{% endcase %}"
|
|
184
|
-
),
|
|
185
|
-
expect="barbaz",
|
|
186
|
-
globals={},
|
|
187
|
-
future=True,
|
|
188
|
-
),
|
|
189
|
-
Case(
|
|
190
|
-
description="falsy when before and truthy when after else",
|
|
191
|
-
template=(
|
|
192
|
-
r"{% case 'x' %}{% when 'y' %}foo{% else %}bar"
|
|
193
|
-
r"{% when 'x' %}baz{% endcase %}"
|
|
194
|
-
),
|
|
195
|
-
expect="barbaz",
|
|
196
|
-
globals={},
|
|
197
|
-
future=True,
|
|
198
|
-
),
|
|
199
|
-
Case(
|
|
200
|
-
description="falsy when before and truthy when after multiple else blocks",
|
|
201
|
-
template=(
|
|
202
|
-
r"{% case 'x' %}{% when 'y' %}foo{% else %}bar"
|
|
203
|
-
r"{% else %}baz{% when 'x' %}qux{% endcase %}"
|
|
204
|
-
),
|
|
205
|
-
expect="barbazqux",
|
|
206
|
-
globals={},
|
|
207
|
-
future=True,
|
|
208
|
-
),
|
|
209
|
-
Case(
|
|
210
|
-
description="truthy when before and after else",
|
|
211
|
-
template=(
|
|
212
|
-
r"{% case 'x' %}{% when 'x' %}foo"
|
|
213
|
-
r"{% else %}bar{% when 'x' %}baz{% endcase %}"
|
|
214
|
-
),
|
|
215
|
-
expect="foobaz",
|
|
216
|
-
globals={},
|
|
217
|
-
future=True,
|
|
218
|
-
),
|
|
219
|
-
Case(
|
|
220
|
-
description="truthy and empty when block before else",
|
|
221
|
-
template=(r"{% case 'x' %}{% when 'x' %}{% else %}bar{% endcase %}"),
|
|
222
|
-
expect="",
|
|
223
|
-
globals={},
|
|
224
|
-
future=True,
|
|
225
|
-
),
|
|
226
|
-
]
|
liquid/golden/ceil_filter.py
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"""Golden tests cases for testing liquid's built-in `ceil` filter."""
|
|
2
|
-
|
|
3
|
-
from liquid.golden.case import Case
|
|
4
|
-
|
|
5
|
-
cases = [
|
|
6
|
-
Case(
|
|
7
|
-
description="positive integer",
|
|
8
|
-
template=r"{{ 5 | ceil }}",
|
|
9
|
-
expect="5",
|
|
10
|
-
),
|
|
11
|
-
Case(
|
|
12
|
-
description="negative integer",
|
|
13
|
-
template=r"{{ -5 | ceil }}",
|
|
14
|
-
expect="-5",
|
|
15
|
-
),
|
|
16
|
-
Case(
|
|
17
|
-
description="positive float",
|
|
18
|
-
template=r"{{ 5.4 | ceil }}",
|
|
19
|
-
expect="6",
|
|
20
|
-
),
|
|
21
|
-
Case(
|
|
22
|
-
description="negative float",
|
|
23
|
-
template=r"{{ -5.4 | ceil }}",
|
|
24
|
-
expect="-5",
|
|
25
|
-
),
|
|
26
|
-
Case(
|
|
27
|
-
description="zero",
|
|
28
|
-
template=r"{{ 0 | ceil }}",
|
|
29
|
-
expect="0",
|
|
30
|
-
),
|
|
31
|
-
Case(
|
|
32
|
-
description="positive string float",
|
|
33
|
-
template=r'{{ "5.1" | ceil }}',
|
|
34
|
-
expect="6",
|
|
35
|
-
),
|
|
36
|
-
Case(
|
|
37
|
-
description="negative string float",
|
|
38
|
-
template=r'{{ "-5.1" | ceil }}',
|
|
39
|
-
expect="-5",
|
|
40
|
-
),
|
|
41
|
-
Case(
|
|
42
|
-
description="unexpected argument",
|
|
43
|
-
template=r"{{ -3.1 | ceil: 1 }}",
|
|
44
|
-
expect="",
|
|
45
|
-
error=True,
|
|
46
|
-
),
|
|
47
|
-
Case(
|
|
48
|
-
description="string not a number",
|
|
49
|
-
template=r'{{ "hello" | ceil }}',
|
|
50
|
-
expect="0",
|
|
51
|
-
),
|
|
52
|
-
Case(
|
|
53
|
-
description="not a string, int or float",
|
|
54
|
-
template=r"{{ a | ceil }}",
|
|
55
|
-
expect="0",
|
|
56
|
-
globals={"a": {}},
|
|
57
|
-
),
|
|
58
|
-
Case(
|
|
59
|
-
description="undefined left value",
|
|
60
|
-
template=r"{{ nosuchthing | ceil }}",
|
|
61
|
-
expect="0",
|
|
62
|
-
),
|
|
63
|
-
]
|