chore: regenerate fixture corpus at pipeline_commit e64a046
Tracks the corpus published 2026-07-30, which adds category_type = 'balance' (pipeline#76) and the I/Q/Y flow codes (pipeline#78) -- the crosswalk prerequisite for #11's three-concept expenditure model. Fixture crosswalk goes 291 -> 324 rows and gains balance_subtype. Only three files change (series_breaks, summary_categories, manifest); no long partition moves, because the published change was metadata-only. test-categories.R's vocabulary assertions extended for the new values: category_type gains 'balance', spending subtypes gain 'interest' and 'insurance_benefits', revenue subtypes gain 'insurance_trust'. cog_categories() is a catalogue verb so it surfaces every category_type the corpus carries; the stock/flow guard belongs on the money verbs. Suite: 0 failures, 2 skips (the #11 and #12 blocks).
This commit is contained in:
@@ -8,7 +8,14 @@ test_that("cog_categories returns all categories grouped by subtype", {
|
||||
expect_gt(nrow(r), 10L)
|
||||
# corpus preserves Census-native "expenditure" vocabulary; the API takes
|
||||
# "spending" as a friendlier alias.
|
||||
expect_setequal(unique(r$category_type), c("expenditure", "revenue"))
|
||||
#
|
||||
# `balance` joined as a third category_type with the cash-and-security
|
||||
# holding codes (pipeline#76). `cog_categories()` is a CATALOGUE verb, not a
|
||||
# money verb, so it surfaces every category_type the corpus carries -- the
|
||||
# stock/flow guard belongs on cog_spending()/cog_revenue(), which must never
|
||||
# return a balance row.
|
||||
expect_setequal(unique(r$category_type),
|
||||
c("expenditure", "revenue", "balance"))
|
||||
})
|
||||
|
||||
test_that("cog_categories(type = 'spending') returns only expenditure rows", {
|
||||
@@ -18,8 +25,13 @@ test_that("cog_categories(type = 'spending') returns only expenditure rows", {
|
||||
# "assistance" (the J-prefix aid/benefit codes) joined the vocabulary with
|
||||
# the crosswalk completion in cog_pipeline#60/#65 -- every flow code
|
||||
# carrying dollars now maps to a category.
|
||||
# `interest` (I89, I91-I94) and `insurance_benefits` (Y05/Y06/Y14/Y53)
|
||||
# joined with the I/Q/Y flow batch -- the last two characters of Census's
|
||||
# expenditure taxonomy. `interest` is what makes the three-concept model
|
||||
# computable: primary = direct minus debt service.
|
||||
expect_true(all(r$subtype %in%
|
||||
c("operations", "capital", "intergovernmental", "assistance")))
|
||||
c("operations", "capital", "intergovernmental", "assistance",
|
||||
"interest", "insurance_benefits")))
|
||||
})
|
||||
|
||||
test_that("cog_categories surfaces the intergovernmental spending subtype", {
|
||||
@@ -37,8 +49,12 @@ test_that("cog_categories(type = 'revenue') returns only revenue rows", {
|
||||
skip_if_no_corpus()
|
||||
r <- cog_categories(type = "revenue")
|
||||
expect_true(all(r$category_type == "revenue"))
|
||||
# `insurance_trust` (Y01/Y02/Y04/Y11/Y12/Y51/Y52) is deliberately NOT
|
||||
# own_source: Census's "General Revenue" excludes insurance trust revenue,
|
||||
# and Y01 alone is $1.31T corpus-wide.
|
||||
expect_true(all(r$subtype %in%
|
||||
c("own_source", "federal", "state", "local_aid")))
|
||||
c("own_source", "federal", "state", "local_aid",
|
||||
"insurance_trust")))
|
||||
})
|
||||
|
||||
test_that("cog_categories(pattern = ...) filters case-insensitively", {
|
||||
|
||||
Reference in New Issue
Block a user