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:
2026-07-11 09:32:02 -04:00
parent 570a9408a2
commit 92c9a7382e
9 changed files with 95 additions and 85 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
test_that("cog_explain prints verb header and target", {
skip_if_no_corpus()
r <- cog_spending("101006006", 2020L, "Corrections")
r <- cog_spending("121011212191", 2020L, "Corrections")
# cli writes to stderr; capture both stdout and message streams.
txt <- paste(c(
capture.output(cog_explain(r)),
@@ -8,19 +8,19 @@ test_that("cog_explain prints verb header and target", {
), collapse = "\n")
expect_true(grepl("cog_spending", txt))
expect_true(grepl("Corrections", txt))
expect_true(grepl("101006006", txt))
expect_true(grepl("121011212191", txt))
})
test_that("cog_explain format='list' returns structured provenance", {
skip_if_no_corpus()
r <- cog_spending("101006006", 2020L, "Corrections")
r <- cog_spending("121011212191", 2020L, "Corrections")
prov <- cog_explain(r, format = "list")
expect_identical(prov, attr(r, "provenance"))
})
test_that("cog_explain returns result invisibly for chaining", {
skip_if_no_corpus()
r <- cog_spending("101006006", 2020L, "Corrections")
r <- cog_spending("121011212191", 2020L, "Corrections")
res <- withVisible(cog_explain(r))
expect_false(res$visible)
expect_identical(res$value, r)
@@ -34,7 +34,7 @@ test_that("cog_explain errors on non-verb input", {
test_that("cog_explain prints denominator + popyear_range + counts", {
skip_if_no_corpus()
with_fixture_corpus({
r <- cog_spending("101006006", years = 2019:2020,
r <- cog_spending("121011212191", years = 2019:2020,
category = "Police", per_capita = TRUE)
out <- paste(c(
capture.output(cog_explain(r)),