-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
84 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
from loader import extract_variables | ||
from parse_metaprompt import parse_metaprompt, extract_tokens | ||
|
||
|
||
def test_extractor_1(): | ||
prompt=""" | ||
prompt = """ | ||
[:foo] | ||
""" | ||
assert extract_variables(parse_metaprompt(prompt)) == set(["foo"]) | ||
|
||
|
||
def test_extractor_2(): | ||
prompt=""" | ||
prompt = """ | ||
[:foo][:bar] | ||
""" | ||
assert extract_variables(parse_metaprompt(prompt)) == set(["foo","bar"]) | ||
assert extract_variables(parse_metaprompt(prompt)) == set(["foo", "bar"]) | ||
|
||
|
||
def test_extractor_assign_1(): | ||
prompt=""" | ||
prompt = """ | ||
[:foo=baz][:bar] | ||
""" | ||
assert extract_variables(parse_metaprompt(prompt)) == set(["bar"]) | ||
|
||
|
||
def test_extractor_assign_2(): | ||
prompt=""" | ||
prompt = """ | ||
[:foo=baz][:foo] | ||
""" | ||
assert extract_variables(parse_metaprompt(prompt)) == set() | ||
|
||
|
||
def test_extractor_assign_3(): | ||
prompt=""" | ||
prompt = """ | ||
[:foo][:foo=baz] - first used, then assigned | ||
""" | ||
assert extract_variables(parse_metaprompt(prompt)) == set(["foo"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters