lint, docs
This commit is contained in:
parent
b8dc68fb08
commit
cd8daeefc6
3 changed files with 45 additions and 5 deletions
|
|
@ -660,6 +660,24 @@ contains_any
|
|||
:description:
|
||||
Returns true if any element in ``contains_array`` is in ``string``. False otherwise.
|
||||
|
||||
join
|
||||
~~~~
|
||||
:spec: ``join(separator: String, array: Array) -> String``
|
||||
|
||||
:description:
|
||||
Join all elements in the array together as a string, and insert the
|
||||
separator between them.
|
||||
|
||||
:usage:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
{
|
||||
%join( ", ", ["item1", "item2"] )
|
||||
}
|
||||
|
||||
# "item1, item2"
|
||||
|
||||
lower
|
||||
~~~~~
|
||||
:spec: ``lower(string: String) -> String``
|
||||
|
|
@ -710,6 +728,23 @@ string
|
|||
:description:
|
||||
Cast to String.
|
||||
|
||||
strip
|
||||
~~~~~
|
||||
:spec: ``strip(string: String) -> String``
|
||||
|
||||
:description:
|
||||
Strip a string of all its whitespace at the beginning and end.
|
||||
|
||||
:usage:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
{
|
||||
%trim(" delete the outer! ")
|
||||
}
|
||||
|
||||
# "delete the outer!"
|
||||
|
||||
titlecase
|
||||
~~~~~~~~~
|
||||
:spec: ``titlecase(string: String) -> String``
|
||||
|
|
|
|||
|
|
@ -181,7 +181,8 @@ class StringFunctions:
|
|||
def join(separator: String, array: Array) -> String:
|
||||
"""
|
||||
:description:
|
||||
Join all elements in the array together as a string, and insert the separator between them.
|
||||
Join all elements in the array together as a string, and insert the
|
||||
separator between them.
|
||||
|
||||
:usage:
|
||||
|
||||
|
|
@ -212,4 +213,4 @@ class StringFunctions:
|
|||
|
||||
# "delete the outer!"
|
||||
"""
|
||||
return String(string.value.strip())
|
||||
return String(string.value.strip())
|
||||
|
|
|
|||
|
|
@ -155,7 +155,11 @@ class TestNumericFunctions:
|
|||
|
||||
@pytest.mark.parametrize(
|
||||
"value, expected_output",
|
||||
[("['a', 'b', 'c']", 'a, b, c'), ("['nope', [], {}]", 'nope, [], {}'), ("['a', 1, 3.14, True]", 'a, 1, 3.14, true')],
|
||||
[
|
||||
("['a', 'b', 'c']", "a, b, c"),
|
||||
("['nope', [], {}]", "nope, [], {}"),
|
||||
("['a', 1, 3.14, True]", "a, 1, 3.14, true"),
|
||||
],
|
||||
)
|
||||
def test_join(self, value, expected_output):
|
||||
output = single_variable_output(f"{{%join(', ', {value})}}")
|
||||
|
|
@ -163,8 +167,8 @@ class TestNumericFunctions:
|
|||
|
||||
@pytest.mark.parametrize(
|
||||
"value, expected_output",
|
||||
[(" delete outer ", 'delete outer'), (" delete me\n\n", 'delete me')],
|
||||
[(" delete outer ", "delete outer"), (" delete me\n\n", "delete me")],
|
||||
)
|
||||
def test_strip(self, value, expected_output):
|
||||
output = single_variable_output(f"{{%strip('{value}')}}")
|
||||
assert output == expected_output
|
||||
assert output == expected_output
|
||||
|
|
|
|||
Loading…
Reference in a new issue