tests/testthat/test-tidy_balance_sheets.R

# test_that("treat balance sheet of two types of institution", {
#   local({
#     get_balance_sheets(
#       instituicao = c("COOPERATIVAS", "BANCOS"),
#       meses = c(6, 12),
#       first_year = 2022,
#       final_year = as.numeric(format(Sys.time(), "%Y")) - 2,
#       overwrite = TRUE
#     )
#     tidy_balance_sheets(
#       path_raw = "data_raw",
#       out_dir = "data",
#       doc_filter = 4010,
#       save = TRUE
#     )
#   })
#   expect_true(
#     fs::file_exists("data/4010_cooperativas.csv") &
#       fs::file_exists("data/4010_bancos.csv")
#   )
# })

# # Delete directory after tests
# fs::dir_delete("data_raw")
# fs::dir_delete("data")

# test_that("treat balance sheet of two types of institutions for 2 months", {
#   local({
#     get_balance_sheets(
#       instituicao = c("COOPERATIVAS", "BANCOS"),
#       meses = c(6, 12),
#       first_year = 2022,
#       final_year = as.numeric(format(Sys.time(), "%Y")) - 2,
#       overwrite = TRUE
#     )
#     tidy_balance_sheets(
#       path_raw = "data_raw",
#       out_dir = "data",
#       doc_filter = 4060,
#       save = TRUE
#     )
#   })
#   expect_true(
#     fs::file_exists("data/bal_cooperativas.csv") &
#       fs::file_exists("data/bal_bancos.csv")
#   )
# })

# # Delete directory after tests
# fs::dir_delete("data_raw")
# fs::dir_delete("data")

Try the bacenR package in your browser

Any scripts or data that you put into this service are public.

bacenR documentation built on Oct. 24, 2026, 1:07 a.m.