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

Fix test snapshots #116

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Authors’
DD
DoB
FST
Knit’
Maechler
RStudio
TSV
YY
YYYY
blogpost
cli
codecov
etc
filepath
gdata
nd
pkgdown
qtr
rOpenSci
rd
tibble
tidyverse
’s
15 changes: 11 additions & 4 deletions tests/testthat/_snaps/format_postcode.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

Code
format_postcode("g2")
Warning <rlang_warning>
Condition
Warning:
1 value has lower case letters these will be converted to upper case.
Warning:
1 non-NA input value does not adhere to the standard UK postcode format (with or without spaces) and will be coded as NA.
The standard format is:
* 1 or 2 letters, followed by
Expand All @@ -18,8 +20,10 @@

Code
format_postcode(c("DG98BS", "dg98b"))
Warning <rlang_warning>
Condition
Warning:
1 value has lower case letters these will be converted to upper case.
Warning:
1 non-NA input value does not adhere to the standard UK postcode format (with or without spaces) and will be coded as NA.
The standard format is:
* 1 or 2 letters, followed by
Expand All @@ -34,7 +38,8 @@

Code
format_postcode(c("ML53RB", NA, "ML5", "???", 53, as.factor("ML53RB")))
Warning <rlang_warning>
Condition
Warning:
4 non-NA input values do not adhere to the standard UK postcode format (with or without spaces) and will be coded as NA.
The standard format is:
* 1 or 2 letters, followed by
Expand All @@ -53,8 +58,10 @@
[1] "KY1 1RZ" NA NA NA
Code
format_postcode(c("KY1 1RZ", "ky1rz", "KY11 R", "KY11R!"), quiet = FALSE)
Warning <rlang_warning>
Condition
Warning:
1 value has lower case letters these will be converted to upper case.
Warning:
3 non-NA input values do not adhere to the standard UK postcode format (with or without spaces) and will be coded as NA.
The standard format is:
* 1 or 2 letters, followed by
Expand Down
196 changes: 110 additions & 86 deletions tests/testthat/_snaps/rename.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,164 +2,179 @@

Code
expect_equal(stringr::str_length(postcode("G26QE", format = "pc7")), 7)
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_equal(stringr::str_length(postcode("G26QE", format = "pc8")), 6)
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_equal(stringr::str_length(postcode(c("KA89NB", "PA152TY"), format = "pc7")),
c(7, 7))
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_equal(stringr::str_length(postcode(c("KA89NB", "PA152TY"), format = "pc8")),
c(7, 8))
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_equal(postcode("G36RB"), "G3 6RB")
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_equal(postcode("G432XR"), "G43 2XR")
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_equal(postcode("DG29BA"), "DG2 9BA")
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_equal(postcode("FK101RY"), "FK101RY")
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_equal(postcode("E1W3TJ"), "E1W 3TJ")
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_equal(postcode("EC1Y8SE"), "EC1Y8SE")
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
input_hampden <- c("G429BA", "g429ba", "G42 9BA", "G 4 2 9 B A", "G429b a")
formatted_hampden <- suppressWarnings(postcode(input_hampden))
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
expect_true(length(unique(postcode(input_hampden))) == 1)
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_true(length(unique(formatted_hampden)) == 1)
Error <simpleError>
object 'formatted_hampden' not found
Code
expect_equal(unique(formatted_hampden), "G42 9BA")
Error <simpleError>
object 'formatted_hampden' not found
expect_equal(unique(postcode(input_hampden)), "G42 9BA")
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_true(is.na(suppressWarnings(postcode("G2?QE"))))
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_warning(postcode(c("G207AL", "G2O07AL")))
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_equal(suppressWarnings(postcode(c("EH7 5QG", NA, "EH11 2NL", "EH5 2HF*"))),
c("EH7 5QG", NA, "EH112NL", NA))
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
input_dens <- c("Dd37Jy", "DD37JY", "D d 337JY")
warnings_dens <- capture_warnings(postcode(input_dens))
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
expect_length(capture_warnings(postcode(input_dens)), 2)
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_length(warnings_dens, 2)
Error <simpleError>
object 'warnings_dens' not found
Code
input_pittodrie <- c("ab245qh", NA, "ab245q", "A B245QH")
warnings_pittodrie <- capture_warnings(postcode(input_pittodrie))
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
expect_length(capture_warnings(postcode(input_pittodrie)), 3)
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_length(warnings_pittodrie, 3)
Error <simpleError>
object 'warnings_pittodrie' not found
Code
expect_warning(postcode("g2"), "^1")
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_warning(postcode(c("DG98BS", "dg98b")), "^1")
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_warning(postcode(c("KY1 1RZ", "ky1rz", "KY11 R", "KY11R!")), "^3")
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.
Code
expect_warning(postcode(c("ML53RB", NA, "ML5", "???", 53, as.factor("ML53RB"))),
"^4")
Error <lifecycle_error_deprecated>
`postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `postcode()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `format_postcode()` instead.

# age_group is deprecated

Code
expect_identical(age_group(c(4, 51, 21, 89), 0, 80, 10, as_factor = FALSE), c(
"0-9", "50-59", "20-29", "80+"))
Error <lifecycle_error_deprecated>
`age_group()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `age_group()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `create_age_groups()` instead.
Code
expect_identical(age_group(c(8, 94, 44, 55, 14), 0, 90, 5, as_factor = TRUE),
factor(c("5-9", "90+", "40-44", "55-59", "10-14"), levels = c("0-4", "5-9",
"10-14", "15-19", "20-24", "25-29", "30-34", "35-39", "40-44", "45-49",
"50-54", "55-59", "60-64", "65-69", "70-74", "75-79", "80-84", "85-89", "90+"),
ordered = TRUE))
Error <lifecycle_error_deprecated>
`age_group()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `age_group()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `create_age_groups()` instead.
Code
expect_identical(age_group(c(81, 86, 33, 11), 4, 84, 3, as_factor = FALSE), c(
"79-81", "82+", "31-33", "10-12"))
Error <lifecycle_error_deprecated>
`age_group()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `age_group()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `create_age_groups()` instead.
Code
expect_identical(age_group(c(0, 99, 1000, 5, 5), 5, 90, 5, as_factor = FALSE),
c(NA, "90+", "90+", "5-9", "5-9"))
Error <lifecycle_error_deprecated>
`age_group()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `age_group()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `create_age_groups()` instead.
Code
expect_identical(age_group(10, as_factor = TRUE), factor(c("10-14"), levels = c(
"0-4", "5-9", "10-14", "15-19", "20-24", "25-29", "30-34", "35-39", "40-44",
"45-49", "50-54", "55-59", "60-64", "65-69", "70-74", "75-79", "80-84",
"85-89", "90+"), ordered = TRUE))
Error <lifecycle_error_deprecated>
`age_group()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `age_group()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `create_age_groups()` instead.
Code
expect_error(age_group(c("1", "57", "apple", "12"), as_factor = FALSE))
Expand All @@ -169,51 +184,60 @@

Code
expect_equal(fin_year(as.Date("20120331", "%Y%m%d")), "2011/12")
Error <lifecycle_error_deprecated>
`fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `extract_fin_year()` instead.
Code
expect_equal(fin_year(as.Date("20120401", "%Y%m%d")), "2012/13")
Error <lifecycle_error_deprecated>
`fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `extract_fin_year()` instead.
Code
expect_equal(fin_year(as.POSIXct("20190104", format = "%Y%m%d")), "2018/19")
Error <lifecycle_error_deprecated>
`fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `extract_fin_year()` instead.
Code
expect_equal(fin_year(as.Date("17111993", "%d%m%Y")), "1993/94")
Error <lifecycle_error_deprecated>
`fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `extract_fin_year()` instead.
Code
expect_equal(fin_year(as.Date("19980404", "%Y%m%d")), "1998/99")
Error <lifecycle_error_deprecated>
`fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `extract_fin_year()` instead.
Code
expect_equal(fin_year(as.Date("21-Jan-2017", "%d-%B-%Y")), "2016/17")
Error <lifecycle_error_deprecated>
`fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `extract_fin_year()` instead.
Code
expect_equal(fin_year(as.POSIXct("20181401", format = "%Y%d%m")), "2017/18")
Error <lifecycle_error_deprecated>
`fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `extract_fin_year()` instead.
Code
expect_equal(fin_year(lubridate::dmy(29102019)), "2019/20")
Error <lifecycle_error_deprecated>
`fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `extract_fin_year()` instead.
Code
expect_error(fin_year("28102019"))
expect_error(fin_year("28-Oct-2019"))
expect_error(fin_year(as.numeric("28102019")))
expect_error(fin_year(as.factor("28-Oct-2019")))
expect_equal(fin_year(c(lubridate::dmy(5012020), NA)), c("2019/20", NA))
Error <lifecycle_error_deprecated>
`fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
Condition
Error:
! `fin_year()` was deprecated in phsmethods 0.2.1 and is now defunct.
i Please use `extract_fin_year()` instead.

Loading
Loading