lint, docs

This commit is contained in:
Jesse Bannon 2025-05-04 18:04:09 -07:00
parent b8dc68fb08
commit cd8daeefc6
3 changed files with 45 additions and 5 deletions

View file

@ -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``

View file

@ -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:

View file

@ -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,7 +167,7 @@ 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}')}}")