Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we only use one expectation inside the code argument? #17

Closed
howardbaek opened this issue May 12, 2023 · 1 comment
Closed

Can we only use one expectation inside the code argument? #17

howardbaek opened this issue May 12, 2023 · 1 comment

Comments

@howardbaek
Copy link

I was wondering if patrick is designed to only allow one expectation, expect_*(), inside with_parameters_test_that(). The examples only have one expectation, and I've only been able to include one expectation in my testing code:

fixed_names = c("index", "original_text", "text", "wav",
                "file", "audio_type",
                "duration",
                "service")

with_parameters_test_that("Google Cloud Text-to-Speech / Amazon Polly Translation",
                          {
                            if (tts_auth) {
                              response_df = tts("Algorithmic complexity is a key consideration
                                                when designing efficient solutions for large-scale data processing",
                                                service = company)
                              testthat::expect_s3_class(response_df, char_value)
                            }
                          },
                          tts_auth = c(tts_amazon_auth(), tts_google_auth()),
                          company  = c("amazon", "google"),
                          char_value = "data.frame"
)

with_parameters_test_that("Google Cloud Text-to-Speech / Amazon Polly Translation",
                          {
                            if (tts_auth) {
                              response_df = tts("Algorithmic complexity is a key consideration
                                                when designing efficient solutions for large-scale data processing",
                                                service = company)
                              testthat::expect_equal(response_df$service, char_value)
                            }
                          },
                          tts_auth = c(tts_amazon_auth(), tts_google_auth()),
                          company  = c("amazon", "google"),
                          char_value = c("amazon", "google")
)

with_parameters_test_that("Google Cloud Text-to-Speech / Amazon Polly Translation",
                          {
                            if (tts_auth) {
                              response_df = tts("Algorithmic complexity is a key consideration
                                                when designing efficient solutions for large-scale data processing",
                                                service = company)
                              audio_value = response_df$wav[[1]]
                              testthat::expect_s4_class(audio_value, char_value)
                            }
                          },
                          tts_auth = c(tts_amazon_auth(), tts_google_auth()),
                          company  = c("amazon", "google"),
                          char_value = "Wave"
)
@michaelquinn32
Copy link
Member

The code in the block functions the same as testthat test. You can definitely have multiple expectations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants