-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test around UpdatedLHTPicker class
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
test_that("Pick updated LHT values given new data at once", { | ||
u_lht_picker <- UpdatedLHTPicker$new( | ||
testing_db, | ||
wanted_update_taxon_details , | ||
fishlife_context$updated_prefix, | ||
fishlife_context$transform_function_list, | ||
fishlife_context$backtransform_function_list, | ||
fishlife_context$lht_names | ||
) | ||
updated_lht_df <- u_lht_picker$pick_and_transform() | ||
non_logarithmic_scale <- 10 | ||
|
||
expect_true(nrow(updated_lht_df) == 2) | ||
expect_true(any(!is.na(updated_lht_df[updated_lht_df$taxon == 'Trisopterus luscus',]))) | ||
expect_true(any(!is.na(updated_lht_df[updated_lht_df$taxon == 'Pollachius pollachius',]))) | ||
|
||
# Ensure values have been backtransformed | ||
expect_true(updated_lht_df[updated_lht_df$taxon == 'Trisopterus luscus', 'Linf'] > non_logarithmic_scale) | ||
expect_true(updated_lht_df[updated_lht_df$taxon == 'Pollachius pollachius', 'Linf'] > non_logarithmic_scale) | ||
expect_equal(updated_lht_df[updated_lht_df$taxon == 'Trisopterus luscus', 'updated_Linf'], 44.24, tolerance = 0.01) | ||
}) |