-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect JSON in output and use code block for it and make long outputs…
… scrollable (#306) * wip * Detect JSON is outputs and make long outputs scrollable * fix tests
- Loading branch information
1 parent
638bc02
commit 18c5bb7
Showing
9 changed files
with
140 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
# 0.5 - API | ||
# 2 - Release | ||
# 3 - Contributing | ||
# 5 - Template Page | ||
# 10 - Default | ||
search: | ||
boost: 0.5 | ||
--- | ||
|
||
::: fastagency.helpers.jsonify_string |
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from fastagency.helpers import jsonify_string | ||
|
||
|
||
def test_hello() -> None: | ||
demo_text = """Hello, {"a": {"b": "c"}} is some json data, but also {"c": [1,2,3]} is too""" | ||
expected = """Hello, | ||
``` | ||
{ | ||
"a": { | ||
"b": "c" | ||
} | ||
} | ||
``` | ||
is some json data, but also | ||
``` | ||
{ | ||
"c": [ | ||
1, | ||
2, | ||
3 | ||
] | ||
} | ||
``` | ||
is too""" | ||
actual = jsonify_string(demo_text) | ||
assert actual == expected, actual | ||
|
||
|
||
def test_bad_suggested_function_call() -> None: | ||
content = "**function_name**: `search_gifs`<br>\n**call_id**: `call_T70PONfhtAqCu6FdRWp1frAS`<br>\n**arguments**: {'q': 'cats', 'limit': 5}\n" | ||
expected = """**function_name**: `search_gifs`<br> | ||
**call_id**: `call_T70PONfhtAqCu6FdRWp1frAS`<br> | ||
**arguments**:{'q': 'cats', 'limit': 5} | ||
""" | ||
actual = jsonify_string(content) | ||
assert actual == expected, actual |
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