Skip to content

Commit

Permalink
Add a test for play
Browse files Browse the repository at this point in the history
  • Loading branch information
vegito22 committed Oct 12, 2024
1 parent f8fb9f5 commit 43494ef
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions llmstack/play/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import liquid

from llmstack.play.utils import extract_variables_from_liquid_template

# Define the Liquid template
liquid_template = """
{{ processor1.key1 }}
{% assign var = processor2.key1 | abs %}
{{var}}
{% for order in processor3.key1 %}
{% if order.id == processor6.key1 %}
{{ order.id }}
{% endif %}
{% endfor %}
{% if processor4.key1 %}
{{ processor4.key1 }}
{% else %}
{{ processor5.key2 }}
{% endif %}
{{ processor7.key1[0].foo | default: "default" }}
"""


# Create a Liquid environment and parse the template
env = liquid.Environment()
template = env.from_string(liquid_template)

print(extract_variables_from_liquid_template(template))

0 comments on commit 43494ef

Please sign in to comment.