Skip to content

Commit

Permalink
test(pull_data): Tests for vector of common name
Browse files Browse the repository at this point in the history
@chantelwetzel-noaa this test is currently failing because when you use
a vector of common names the number of entries is doubled for a single
species. For example, lingcod has 705 rows but when I pull for lingcod
and sablefish I am getting 1410 rows of lingcod. I haven't delved into
this further as of yet.
  • Loading branch information
kellijohnson-NOAA committed Mar 28, 2024
1 parent 2e5e40c commit 754fb84
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/testthat/test-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@ test_that("pull_catch-multispecies", {
expect_equal(nrow(dat), 350126)
expect_equal(length(which(dat$cpue_kg_km2 == 0)), 330971)

dat_lingcod <- pull_catch(
common_name = "lingcod",
years = c(2017),
survey = "NWFSC.Combo",
verbose = TRUE
)
dat_lingcod_sablefish <- pull_catch(
common_name = c("lingcod", "sablefish"),
years = c(2017),
survey = "NWFSC.Combo",
verbose = TRUE
)
expect_equal(
NROW(dplyr::filter(dat, Common_name == "lingcod")),
NROW(dat_lingcod),
label = "entries of all species filtered for lingcod",
expected.label = "entries of lingcod"
)
expect_equal(
NROW(dplyr::filter(dat_lingcod_sablefish, Common_name == "lingcod")),
NROW(dat_lingcod),
label = "entries of 2 species filtered for lingcod",
expected.label = "entries of lingcod"
)
})

test_that("PullHaul", {
Expand Down

0 comments on commit 754fb84

Please sign in to comment.