Skip to content

Commit 28443bd

Browse files
authored
Ggplot update review (#293)
* Update test-plot_fastest to reflect ggplot2 4.0.0 changes #292 * Update NEWS.md
1 parent dacd0bd commit 28443bd

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Removed support for FastF1 v < 3.0 (now causes errors instead of warnings).
66
* Test suite and automated testing changes to reflect the above changes.
77
* Fixed a data conversion issue in `time_to_sec()` (#290)
8+
* Updated testing to comply with changes in ggplot2 (#292)
89

910
# f1dataR 2.0.1
1011

tests/testthat/test-plot_fastest.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ test_that("graphics work", {
5959
qualiplot <- plot_fastest(2023, 1, "Q", "HAM", "gear")
6060
})
6161
})
62-
expect_equal(gear$label$title, speed$label$title)
63-
expect_equal(gear$label$caption, "Generated by {f1dataR} package")
64-
expect_true(grepl("Lewis Hamilton Fastest Lap", gear$label$subtitle))
62+
expect_equal(ggplot2::get_labs(gear)$title, ggplot2::get_labs(speed)$title)
63+
expect_equal(ggplot2::get_labs(gear)$caption, "Generated by {f1dataR} package")
64+
expect_true(grepl("Lewis Hamilton Fastest Lap", ggplot2::get_labs(gear)$subtitle))
6565

66-
expect_equal(qualiplot$label$title, "2023 Bahrain Grand Prix Qualifying")
66+
expect_equal(ggplot2::get_labs(qualiplot)$title, "2023 Bahrain Grand Prix Qualifying")
6767

6868
qp_axis <- qualiplot + theme_dark_f1(axis_marks = TRUE)
6969

70-
expect_equal(qp_axis$labels, qualiplot$labels)
70+
expect_equal(ggplot2::get_labs(qp_axis), ggplot2::get_labs(qualiplot))
7171
})
7272

7373
test_that("correct_track_ratio works", {

tests/testthat/test-utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test_that("utility functions work", {
1414
# get_jolpica_content() is inherently tested in load_x functions too
1515
url <- "2022/circuits.json"
1616

17-
expect_warning(get_ergast_content(url), regexp = "was deprecated in f1dataR")
17+
suppressWarnings(expect_warning(get_ergast_content(url), regexp = "was deprecated in f1dataR"))
1818
# Test for ergast deprecation
1919

2020
# Test add_col_if_absent()

0 commit comments

Comments
 (0)