Skip to content

Commit 5bc0e89

Browse files
committed
test simplified because we don't use factors any more
1 parent 9e1e130 commit 5bc0e89

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

tests/testthat/test-project.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ test_that("Final result the same when called with sim or params", {
243243
# This test is motivated by the bug in
244244
# https://github.com/sizespectrum/mizer/issues/173
245245
test_that("Dimnames on effort have correct names", {
246-
gear_names <- as.character(unique(gear_params(NS_params)$gear))
246+
gear_names <- unique(gear_params(NS_params)$gear)
247247
effort <- array(1, dim = c(3, length(gear_names)),
248248
dimnames = list(1:3,
249249
gear_names))

tests/testthat/test-project_methods.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ test_that("getRDI", {
482482
rdi <- getRDI(params, n, n_full)
483483
# test dim
484484
expect_length(rdi, no_sp)
485-
expect_named(rdi, as.character(params@species_params$species))
485+
expect_named(rdi, params@species_params$species)
486486
# test values
487487
e_repro <- getERepro(params, n = n, n_pp = n_full)
488488
e_repro_pop <- apply(sweep(e_repro * n, 2, params@dw, "*"), 1, sum)
@@ -506,7 +506,7 @@ test_that("getRDI is proportional to volume", {
506506
test_that("getRDD", {
507507
rdd <- getRDD(params, n, n_full)
508508
expect_length(rdd, no_sp)
509-
expect_named(rdd, as.character(params@species_params$species))
509+
expect_named(rdd, params@species_params$species)
510510
rdi <- getRDI(params, n, n_full)
511511
rdd2 <- getRDD(params, n, n_full, rdi = rdi)
512512
expect_identical(rdd, rdd2)

tests/testthat/test-selectivity_funcs.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ test_that("knife-edge selectivity function is working properly", {
1212
# Chop off l25, l50, a and b columns - the trawl selectivity
1313
NS_species_params_gears <- NS_species_params_gears[,!(colnames(NS_species_params_gears) %in% c("l25","l50","a","b"))]
1414
params <- newMultispeciesParams(NS_species_params_gears, inter, info_level = 0)
15-
industrial_species <- as.character(NS_species_params_gears$species[NS_species_params_gears$gear == "Industrial"])
16-
pelagic_species <- as.character(NS_species_params_gears$species[NS_species_params_gears$gear == "Pelagic"])
17-
beam_trawl_species <- as.character(NS_species_params_gears$species[NS_species_params_gears$gear == "Beam"])
18-
otter_trawl_species <- as.character(NS_species_params_gears$species[NS_species_params_gears$gear == "Otter"])
15+
industrial_species <- NS_species_params_gears$species[NS_species_params_gears$gear == "Industrial"]
16+
pelagic_species <- NS_species_params_gears$species[NS_species_params_gears$gear == "Pelagic"]
17+
beam_trawl_species <- NS_species_params_gears$species[NS_species_params_gears$gear == "Beam"]
18+
otter_trawl_species <- NS_species_params_gears$species[NS_species_params_gears$gear == "Otter"]
1919

2020
expect_true(all(params@selectivity["Industrial",industrial_species,params@w < 500] == 0))
2121
expect_true(all(params@selectivity["Industrial",industrial_species,params@w >= 500] == 1))

tests/testthat/test-setFishing.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ test_that("Duplicate gear-species pairs give error", {
260260

261261
test_that("Non-existing species give error", {
262262
gp <- NS_params@gear_params
263-
gp$species <- as.character(gp$species)
264263
gp$species[[1]] <- "test"
265264
expect_error(gear_params(params) <- gp,
266265
"The gear_params dataframe contains species that do not exist in the model.")

0 commit comments

Comments
 (0)