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

Add unit tests #40

Merged
merged 25 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
020bfde
moved tests for plot_biomass and write_captions from old make-tests b…
sbreitbart-NOAA Dec 31, 2024
b07b857
updated test-write_caption (removed "empty test") and added sample da…
sbreitbart-NOAA Dec 31, 2024
65d6926
added test for add_theme
sbreitbart-NOAA Dec 31, 2024
a3fba23
make tests for plot_spawning_biomass
sbreitbart-NOAA Dec 31, 2024
21145ae
Feat(exp_all_figs_tables): Add tryCatch to each function that exports…
sbreitbart-NOAA Jan 2, 2025
8b60edd
Merge pull request #41 from nmfs-ost/exp_all_fxn_failsafe
sbreitbart-NOAA Jan 2, 2025
844ba27
Fix(write_captions):
sbreitbart-NOAA Jan 2, 2025
4bffd12
Merge branch 'master' of https://github.com/nmfs-ost/satf
sbreitbart-NOAA Jan 2, 2025
8d6428f
moved tests for plot_biomass and write_captions from old make-tests b…
sbreitbart-NOAA Dec 31, 2024
c53de94
updated test-write_caption (removed "empty test") and added sample da…
sbreitbart-NOAA Dec 31, 2024
c4342f4
added test for add_theme
sbreitbart-NOAA Dec 31, 2024
3699f8b
make tests for plot_spawning_biomass
sbreitbart-NOAA Dec 31, 2024
c64e466
update .gitignore; working on test-write_captions
sbreitbart-NOAA Jan 2, 2025
697fe4b
Merge branch 'new-tests' of https://github.com/nmfs-ost/satf into new…
sbreitbart-NOAA Jan 2, 2025
9e44972
Added test for write_captions
sbreitbart-NOAA Jan 2, 2025
83bdc90
Added test for plot_landings
sbreitbart-NOAA Jan 2, 2025
21b32bc
add rda-related tests to tests for plot_biomass and plot_spawning_bio…
sbreitbart-NOAA Jan 2, 2025
14b5665
Add tests for plot_recruitment
sbreitbart-NOAA Jan 2, 2025
850a259
Add tests for plot_recruitment_deviations
sbreitbart-NOAA Jan 2, 2025
05081b2
Add tests for plot_spawn_recruitment
sbreitbart-NOAA Jan 2, 2025
c751964
update tests so that rda-related files are deleted upon exiting test,…
sbreitbart-NOAA Jan 2, 2025
bdf2984
Made tests for table_bnc and table_indices
sbreitbart-NOAA Jan 2, 2025
97c11ab
Addressing bug that prevented temporary test-produced files from bein…
sbreitbart-NOAA Jan 3, 2025
324c2d8
Made tests for exp_all_figs_tables
sbreitbart-NOAA Jan 3, 2025
410c480
Fix typo
sbreitbart-NOAA Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ petrale_convert_output.csv
captions_alt_text.csv
converted_file_1126.csv
rda_files
petrale_sole_std_output.csv
173 changes: 108 additions & 65 deletions R/exp_all_figs_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,43 +84,68 @@ exp_all_figs_tables <- function(

# figures

satf::plot_recruitment(dat,
unit_label = recruitment_unit_label,
scale_amount,
end_year,
n_projected_years,
relative,
make_rda,
rda_dir) |> suppressWarnings() |> invisible()

message("Exported plot_recruitment")

satf::plot_biomass(dat,
unit_label = biomass_unit_label,
scale_amount,
ref_line,
ref_point,
end_year,
relative,
make_rda,
rda_dir) |> suppressWarnings() |> invisible()

message("Exported plot_biomass")

satf::plot_landings(dat,
unit_label = landings_unit_label,
make_rda,
rda_dir) |> suppressWarnings() |> invisible()

message("Exported plot_landings")

satf::plot_recruitment_deviations(dat,
end_year,
n_projected_years,
make_rda,
rda_dir) |> suppressWarnings() |> invisible()

message("Exported plot_recruitment_deviations")
tryCatch({
satf::plot_recruitment(
dat,
unit_label = recruitment_unit_label,
scale_amount,
end_year,
n_projected_years,
relative,
make_rda,
rda_dir
) |> suppressWarnings() |> invisible()

message("Exported plot_recruitment")

}, error = function(e) {
message('Failed to export plot_recruitment. Tip: check that your arguments are correct.')
print(e)
})


tryCatch({
satf::plot_biomass(
dat,
unit_label = biomass_unit_label,
scale_amount,
ref_line,
ref_point,
end_year,
relative,
make_rda,
rda_dir
) |> suppressWarnings() |> invisible()

message("Exported plot_biomass")

}, error = function(e) {
message('Failed to export plot_biomass Tip: check that your arguments are correct.')
print(e)
})


tryCatch({
satf::plot_landings(dat, unit_label = landings_unit_label, make_rda, rda_dir) |> suppressWarnings() |> invisible()

message("Exported plot_landings")

}, error = function(e) {
message('Failed to export plot_landings. Tip: check that your arguments are correct.')
print(e)
})

tryCatch({
satf::plot_recruitment_deviations(dat, end_year, n_projected_years, make_rda, rda_dir) |> suppressWarnings() |> invisible()

message("Exported plot_recruitment_deviations")

}, error = function(e) {
message(
'Failed to export plot_recruitment_deviations. Tip: check that your arguments are correct.'
)
print(e)
})

# satf::plot_spawn_recruitment(dat,
# spawning_biomass_label,
Expand All @@ -131,20 +156,28 @@ exp_all_figs_tables <- function(
#
# message("Exported plot_spawn_recruitment")

satf::plot_spawning_biomass(dat,
unit_label = spawning_biomass_label,
scale_amount,
ref_line = ref_line_sb,
ref_point = ref_point_sb,
end_year,
relative,
n_projected_years,
make_rda,
rda_dir) |>
suppressWarnings() |>
invisible()

message("Exported plot_spawning_biomass")
tryCatch({
satf::plot_spawning_biomass(
dat,
unit_label = spawning_biomass_label,
scale_amount,
ref_line = ref_line_sb,
ref_point = ref_point_sb,
end_year,
relative,
n_projected_years,
make_rda,
rda_dir
) |>
suppressWarnings() |>
invisible()

message("Exported plot_spawning_biomass")

}, error = function(e) {
message('Failed to export plot_spawning_biomass. Tip: check that your arguments are correct.')
print(e)
})

# uncomment when this is working properly
# satf::plot_indices(dat,
Expand All @@ -155,20 +188,30 @@ exp_all_figs_tables <- function(
# message("Exported plot_indices")

# tables
satf::table_bnc(dat,
end_year,
biomass_unit_label,
catch_unit_label,
make_rda,
rda_dir) |> suppressWarnings() |> invisible()

message("Exported table_bnc")

satf::table_indices(dat,
make_rda,
rda_dir) |> suppressWarnings() |> invisible()

message("Exported table_indices")
tryCatch({
satf::table_bnc(dat,
end_year,
biomass_unit_label,
catch_unit_label,
make_rda,
rda_dir) |> suppressWarnings() |> invisible()

message("Exported table_bnc")

}, error = function(e) {
message('Failed to export table_bnc. Tip: check that your arguments are correct.')
print(e)
})

tryCatch({
satf::table_indices(dat, make_rda, rda_dir) |> suppressWarnings() |> invisible()

message("Exported table_indices")

}, error = function(e) {
message('Failed to export table_indices. Tip: check that your arguments are correct.')
print(e)
})

# uncomment when finished
# satf::table_landings(dat) |> suppressWarnings() |> invisible()
Expand Down
Loading
Loading