-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaces readline() with menu(), adds test for that
- Loading branch information
1 parent
f26e2cd
commit ceec15f
Showing
7 changed files
with
56 additions
and
13 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
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,21 @@ | ||
# Request submission works | ||
|
||
Code | ||
out$davinci | ||
Output | ||
[1] "OpenAI - Completions - text-davinci-003 (davinci) \n" | ||
|
||
--- | ||
|
||
Code | ||
out$gpt35 | ||
Output | ||
[1] "OpenAI - Chat Completions - gpt-3.5-turbo (gpt35) \n" | ||
|
||
--- | ||
|
||
Code | ||
out$gpt4 | ||
Output | ||
[1] "OpenAI - Chat Completions - gpt-4 (gpt4) \n" | ||
|
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,4 +1,29 @@ | ||
test_that("Model lists output is as expected", { | ||
skip("Will fix as part of the testing upgrades") | ||
expect_snapshot(capture.output(ch_get_ymls(menu = FALSE))) | ||
test_that("Request submission works", { | ||
withr::with_envvar( | ||
new = c("OPENAI_API_KEY" = "test"), | ||
{ | ||
out <- ch_get_ymls(menu = FALSE) | ||
expect_equal(class(out), "list") | ||
expect_snapshot(out$davinci) | ||
expect_snapshot(out$gpt35) | ||
expect_snapshot(out$gpt4) | ||
} | ||
) | ||
}) | ||
|
||
test_that("Menu works", { | ||
withr::with_envvar( | ||
new = c("OPENAI_API_KEY" = "test"), | ||
{ | ||
local_mocked_bindings( | ||
menu = function(...) { | ||
return(1) | ||
} | ||
) | ||
expect_true( | ||
ch_get_ymls(menu = TRUE) %in% c("copilot", "davinci") | ||
) | ||
} | ||
) | ||
}) | ||
|