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

fixing shinytest2 fail for tm_missing_data #738

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

kartikeyakirar
Copy link
Contributor

A test in tm_missing_data is failing because a slider's default value gives an error. It passed in PR 727 with a value of 2L, but here it was showing 1L. I fixed it in PR 733 with app_driver$get_active_module_input("iris-combination_cutoff"), but it's causing an error in another PR again.

To fix I have set.seed in teal_data()

Copy link
Contributor

github-actions bot commented Apr 22, 2024

badge

Code Coverage Summary

Filename                      Stmts    Miss  Cover    Missing
--------------------------  -------  ------  -------  ------------------------------------
R/tm_a_pca.R                    833     833  0.00%    108-1074
R/tm_a_regression.R             779     779  0.00%    153-1037
R/tm_data_table.R               184     184  0.00%    93-330
R/tm_file_viewer.R              172     172  0.00%    44-250
R/tm_front_page.R               132     121  8.33%    70-226
R/tm_g_association.R            336     336  0.00%    135-543
R/tm_g_bivariate.R              678     416  38.64%   303-775, 816, 927, 944, 962, 973-995
R/tm_g_distribution.R          1056    1056  0.00%    122-1317
R/tm_g_response.R               352     352  0.00%    154-579
R/tm_g_scatterplot.R            728     728  0.00%    230-1059
R/tm_g_scatterplotmatrix.R      284     265  6.69%    165-478, 539, 553
R/tm_missing_data.R            1075    1075  0.00%    92-1323
R/tm_outliers.R                 991     991  0.00%    134-1269
R/tm_t_crosstable.R             257     257  0.00%    141-446
R/tm_variable_browser.R         829     824  0.60%    79-1069, 1107-1291
R/utils.R                        99      96  3.03%    82-267
R/zzz.R                           2       2  0.00%    2-3
TOTAL                          8787    8487  3.41%

Diff against main

Filename      Stmts    Miss  Cover
----------  -------  ------  --------
TOTAL             0       0  +100.00%

Results for commit: 4ccfb94

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

Copy link
Contributor

github-actions bot commented Apr 22, 2024

Unit Tests Summary

  1 files   20 suites   10m 6s ⏱️
103 tests 103 ✅ 0 💤 0 ❌
418 runs  418 ✅ 0 💤 0 ❌

Results for commit 4ccfb94.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Apr 22, 2024

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
shinytest2-tm_g_bivariate 💚 $45.51$ $-1.51$ $0$ $0$ $0$ $0$
shinytest2-tm_g_scatterplot 💚 $76.20$ $-1.90$ $0$ $0$ $0$ $0$
shinytest2-tm_g_scatterplotmatrix 💚 $24.45$ $-1.64$ $0$ $0$ $0$ $0$
shinytest2-tm_outliers 💚 $87.26$ $-1.98$ $0$ $0$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
shinytest2-tm_g_scatterplot 💚 $44.23$ $-1.19$ e2e_tm_g_scatterplot_encoding_inputs_produce_output_without_validation_errors

Results for commit fee5414

♻️ This comment has been updated with latest results.

@m7pr
Copy link
Contributor

m7pr commented Apr 22, 2024

Yeah, so without set.seed(123) I get different data each time, hence different cut.off value

image

as this combination cutoff is dependent on the number of NAs in the data

   combination_cutoff_q <- reactive({
      req(common_code_q())
      teal.code::eval_code(
        common_code_q(),
        quote(
          combination_cutoff <- ANL %>%
            dplyr::mutate_all(is.na) %>%
            dplyr::group_by_all() %>%
            dplyr::tally() %>%
            dplyr::ungroup()
        )
      )
    })

    output$cutoff <- renderUI({
      x <- combination_cutoff_q()[["combination_cutoff"]]$n

      # select 10-th from the top
      n <- length(x)
      idx <- max(1, n - 10)
      prev_value <- isolate(input$combination_cutoff)
      value <- `if`(
        is.null(prev_value) || prev_value > max(x) || prev_value < min(x),
        sort(x, partial = idx)[idx], prev_value
      )

      teal.widgets::optionalSliderInputValMinMax(
        ns("combination_cutoff"),
        "Combination cut-off",
        c(value, range(x))
      )
    })

@m7pr
Copy link
Contributor

m7pr commented Apr 22, 2024

And with set.seed before data creation, the data input is the same, hence the calculations for the output are the same
image

@kartikeyakirar kartikeyakirar merged commit 53f9e6c into main Apr 22, 2024
21 checks passed
@kartikeyakirar kartikeyakirar deleted the tm_missing_data_fix_test branch April 22, 2024 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants