test: re-baseline canonical_govid literals to 12-char namespace
Swaps every hardcoded 9-char canonical_govid literal (Broward County,
Fort Lauderdale City, Florida/Alabama state govts, Bexar/Tarrant/Wayne
counties, San Diego/Oakland/Miami/Austin cities) for its 12-char Phase P
equivalent, resolved by name+type+state against the regenerated fixture
xwalk. Also updates two gov_name search patterns that no longer match
under Phase P canonical naming ("FLORIDA STATE GOVT" -> "FLORIDA"; the
"Miami" substring test now pins type = "city" since MIAMI-DADE COUNTY's
canonical name now also contains "Miami", which would otherwise make the
match ambiguous across govs_types instead of resolving via largest-pop).
Underlying per-year population figures for Broward County and Alabama
are unchanged, so no expected data-value literals needed recomputation.
Suite: 126 test blocks / 336 expectations, 0 FAIL / 0 WARN / 0 SKIP.
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
test_that("cog_revenue returns expected shape for Broward Property Tax 2020", {
|
||||
skip_if_no_corpus()
|
||||
r <- cog_revenue("101006006", years = 2020L, category = "Property Tax")
|
||||
r <- cog_revenue("121011212191", years = 2020L, category = "Property Tax")
|
||||
expect_s3_class(r, "tbl_df")
|
||||
expected_cols <- c("year", "canonical_govid", "gov_name", "revenue_subtype",
|
||||
"category", "amt_nominal", "codes_included",
|
||||
"aggregate_fallback", "notes")
|
||||
expect_true(all(expected_cols %in% names(r)))
|
||||
expect_equal(unique(r$canonical_govid), "101006006")
|
||||
expect_equal(unique(r$canonical_govid), "121011212191")
|
||||
expect_equal(unique(r$year), 2020L)
|
||||
})
|
||||
|
||||
test_that("cog_revenue with no category filter returns multiple categories", {
|
||||
skip_if_no_corpus()
|
||||
r <- cog_revenue("101006006", years = 2020L)
|
||||
r <- cog_revenue("121011212191", years = 2020L)
|
||||
expect_gt(length(unique(r$category)), 1L)
|
||||
})
|
||||
|
||||
test_that("cog_revenue with per_capita + adjust_to_year adds all columns", {
|
||||
skip_if_no_corpus()
|
||||
r <- cog_revenue("101006006", 2020L,
|
||||
r <- cog_revenue("121011212191", 2020L,
|
||||
per_capita = TRUE, adjust_to_year = 2022L)
|
||||
expect_true(all(c("amt_nominal", "amt_real",
|
||||
"amt_per_capita_nominal", "amt_per_capita_real") %in%
|
||||
@@ -27,7 +27,7 @@ test_that("cog_revenue with per_capita + adjust_to_year adds all columns", {
|
||||
|
||||
test_that("cog_revenue result has provenance attribute", {
|
||||
skip_if_no_corpus()
|
||||
r <- cog_revenue("101006006", 2020L)
|
||||
r <- cog_revenue("121011212191", 2020L)
|
||||
prov <- attr(r, "provenance")
|
||||
expect_equal(prov$verb, "cog_revenue")
|
||||
expect_true(grepl("revenue_annotated", prov$sql_query))
|
||||
|
||||
Reference in New Issue
Block a user