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

uninformative error for invalid R code inside test_that() chunk #3315

Closed
EmilHvitfeldt opened this issue May 29, 2024 · 3 comments
Closed

uninformative error for invalid R code inside test_that() chunk #3315

EmilHvitfeldt opened this issue May 29, 2024 · 3 comments
Labels
area: diagnostics Issues related to Diagnostics lang: r

Comments

@EmilHvitfeldt
Copy link

Positron Version:

Positron Version: 2024.05.0 (Universal) build 1313
Code - OSS Version: 1.89.0
Commit: b8e5086
Date: 2024-05-29T03:53:21.563Z
Electron: 28.2.8
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 23.4.0

Steps to reproduce the issue:

  1. Write a longish test_that() chunk

(the second to the last all_numeric_predictors() is missing its closing parameter

test_that("ignore_step() works", {
  rec <- recipe(mpg ~ ., data = mtcars)

  rec1234 <- recipe(mpg ~ ., data = mtcars) %>%
    step_dummy(all_nominal_predictors(), id = "dummy") %>%
    step_impute_mean(all_numeric_predictors(), id = "impute_mean") %>%
    step_normalize(all_numeric_predictors()) %>%
    step_pca(all_numeric_predictors(), id = "pca")

  rec234 <- recipe(mpg ~ ., data = mtcars) %>%
    step_impute_mean(all_numeric_predictors(), id = "impute_mean") %>%
    step_normalize(all_numeric_predictors()) %>%
    step_pca(all_numeric_predictors(), id = "pca")

  rec34 <- recipe(mpg ~ ., data = mtcars) %>%
    step_dummy(all_nominal_predictors(), id = "dummy") %>%
    step_impute_mean(all_numeric_predictors(), id = "impute_mean") %>%
    step_normalize(all_numeric_predictors()) %>%
    step_pca(all_numeric_predictors(), id = "pca")

  rec123 <- recipe(mpg ~ ., data = mtcars) %>%
    step_dummy(all_nominal_predictors(), id = "dummy") %>%
    step_impute_mean(all_numeric_predictors(, id = "impute_mean") %>%
    step_normalize(all_numeric_predictors())

  expect_identical(
    ignore_step(rec1234, number = 1),
    rec234
  )

  ignore_step(rec, number = 1)
})
Kapture.2024-05-29.at.15.47.14.mp4

What did you expect to happen?

For a more informative message to appear.

Screenshot 2024-05-29 at 3 48 25 PM

RStudio gives a "Unmatched opening bracket"

Were there any error messages in the output or Developer Tools console?

Nope

@EmilHvitfeldt EmilHvitfeldt added the bug Something isn't working label May 29, 2024
@EmilHvitfeldt
Copy link
Author

it feels like it is related to test_that() as if you remove that but keeps the {} you get different danger squiggly lines

Screenshot 2024-05-29 at 3 55 07 PM
Screenshot 2024-05-29 at 3 55 14 PM

@juliasilge
Copy link
Contributor

I believe this is related to #2943

@juliasilge juliasilge added lang: r area: diagnostics Issues related to Diagnostics and removed bug Something isn't working labels May 30, 2024
@juliasilge juliasilge added this to the Release Candidate milestone May 30, 2024
@DavisVaughan
Copy link
Contributor

Fixed by fixing #2943

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: diagnostics Issues related to Diagnostics lang: r
Projects
None yet
Development

No branches or pull requests

3 participants