Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use snapshot tests in selection error messages (#72)
* Fixes #71; use snapshot tests for selection errors * Use testthat edition 3 * Update testthat snapshots * Suggest testthat >= 3.2.0 * Update snapshots * Require tidyselect 1.2.1 in snapshots --------- Co-authored-by: Derek Burk <burkx031@umn.edu>
- Loading branch information
Showing
16 changed files
with
305 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
# This file is part of the standard setup for testthat. | ||
# It is recommended that you do not modify it. | ||
# | ||
# Where should you do additional test configuration? | ||
# Learn more about the roles of various files in: | ||
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview | ||
# * https://testthat.r-lib.org/articles/special-files.html | ||
|
||
library(testthat) | ||
library(ipumsr) | ||
|
||
test_check("ipumsr", reporter = "location") | ||
test_check("ipumsr") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Can read NHGIS extract: single dataset | ||
|
||
Code | ||
nhgis_csv <- read_nhgis(nhgis_single_csv) | ||
Message | ||
Use of data from NHGIS is subject to conditions including that users should cite the data appropriately. Use command `ipums_conditions()` for more details. | ||
Rows: 71 Columns: 25 | ||
-- Column specification -------------------------------------------------------- | ||
Delimiter: "," | ||
chr (9): GISJOIN, STUSAB, CMSA, PMSA, PMSAA, AREALAND, AREAWAT, ANPSADPI, F... | ||
dbl (13): YEAR, MSA_CMSAA, INTPTLAT, INTPTLNG, PSADC, D6Z001, D6Z002, D6Z003... | ||
lgl (3): DIVISIONA, REGIONA, STATEA | ||
i Use `spec()` to retrieve the full column specification for this data. | ||
i Specify the column types or set `show_col_types = FALSE` to quiet this message. | ||
|
||
# We get informative error messages when reading NHGIS extracts | ||
|
||
Code | ||
read_nhgis(nhgis_multi_ds, file_select = 3, verbose = FALSE) | ||
Condition | ||
Error in `find_files_in()`: | ||
! Can't select files past the end. | ||
i Location 3 doesn't exist. | ||
i There are only 2 files. | ||
Available files: | ||
* nhgis0731_csv/nhgis0731_ds239_20185_nation.csv | ||
* nhgis0731_csv/nhgis0731_ts_nominal_state.csv | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# We get informative errors when reading shapefiles | ||
|
||
Code | ||
read_ipums_sf(nhgis_multi_shp, file_select = 4) | ||
Condition | ||
Error in `find_files_in()`: | ||
! Can't select files past the end. | ||
i Location 4 doesn't exist. | ||
i There are only 3 files. | ||
Available files: | ||
* nhgis0712_shape/nhgis0712_shapefile_cenpop2000_us_state_cenpop_2000.zip | ||
* nhgis0712_shape/nhgis0712_shapefile_tl2000_us_pmsa_1990.zip | ||
* nhgis0712_shape/nhgis0712_shapefile_tl2000_us_pmsa_2000.zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.