Skip to content

Commit

Permalink
simplify the test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sghael committed Jun 24, 2024
1 parent 410f293 commit 55732a4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/test_term_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,20 @@ def test_parse_with_escape_blocks():
'this is a prompt {start}my first context block{end} and then ```my second context block```',
{'bar': '1.0', 'baz': '2.0'},
),
(
"{start}this is a prompt --bar=1.0 --baz=2.0{end}",
"{start}this is a prompt --bar=1.0 --baz=2.0{end}",
{}
)
]

delimiters = ["```", '"""', "`"]

for start, end in [(d, d) for d in delimiters]:
assert parse_args(f"{start}this is a prompt --bar=1.0 --baz=2.0{end}") == (
f"{start}this is a prompt --bar=1.0 --baz=2.0{end}",
{},
)
for prompt, expected_prompt, expected_args in test_cases:
formatted_prompt = prompt.format(start=start, end=end)
formatted_expected_prompt = expected_prompt.format(start=start, end=end)
assert parse_args(formatted_prompt) == (
formatted_expected_prompt,
expected_args,
)
)

0 comments on commit 55732a4

Please sign in to comment.