@@ -10,11 +10,11 @@ sas_path <- fs::path_temp("sas_bef")
1010save_as_sas(bef_list , sas_path )
1111sas_bef <- fs :: dir_ls(sas_path )
1212
13- # Test convert_file () ----------------------------------------------------------
13+ # Test convert () ----------------------------------------------------------
1414
1515# Setup: Convert single file
1616single_file_path <- fs :: path_temp(" parquet_single_file" )
17- single_file_output <- convert_file (
17+ single_file_output <- convert (
1818 path = sas_bef [[1 ]],
1919 output_dir = single_file_path
2020)
@@ -25,11 +25,11 @@ data_actual <- arrow::open_dataset(
2525 dplyr :: as_tibble()
2626data_expected <- haven :: read_sas(sas_bef [[1 ]])
2727
28- test_that(" convert_file () returns output_dir" , {
28+ test_that(" convert () returns output_dir" , {
2929 expect_equal(single_file_output , single_file_path )
3030})
3131
32- test_that(" convert_file () preserves source data and adds expected columns" , {
32+ test_that(" convert () preserves source data and adds expected columns" , {
3333 expect_equal(nrow(data_actual ), nrow(data_expected ))
3434 expect_identical(
3535 data_actual | > dplyr :: select(- c(" source_file" , " year" )),
@@ -48,7 +48,7 @@ test_that("convert_file() preserves source data and adds expected columns", {
4848 )
4949})
5050
51- test_that(" convert_file () creates parts with expected naming pattern" , {
51+ test_that(" convert () creates parts with expected naming pattern" , {
5252 actual <- fs :: path_file(fs :: dir_ls(
5353 single_file_path ,
5454 recurse = TRUE ,
@@ -57,33 +57,33 @@ test_that("convert_file() creates parts with expected naming pattern", {
5757 expect_true(all(stringr :: str_detect(actual , " ^part-[a-f0-9]{6}\\ .parquet$" )))
5858})
5959
60- test_that(" convert_file () errors with incorrect input parameters" , {
60+ test_that(" convert () errors with incorrect input parameters" , {
6161 # Incorrect path type.
6262 expect_error(
63- convert_file (path = 1 , output_dir = single_file_output ),
63+ convert (path = 1 , output_dir = single_file_output ),
6464 regexp = " character"
6565 )
6666 # Path must exist.
6767 expect_error(
68- convert_file (path = fs :: file_temp(), output_dir = single_file_output ),
68+ convert (path = fs :: file_temp(), output_dir = single_file_output ),
6969 regexp = " does not exist"
7070 )
7171 # Incorrect output_dir type.
7272 expect_error(
73- convert_file (path = sas_bef [[1 ]], output_dir = 1 ),
73+ convert (path = sas_bef [[1 ]], output_dir = 1 ),
7474 regexp = " string"
7575 )
7676 # output_dir must be scalar.
7777 expect_error(
78- convert_file (
78+ convert (
7979 path = sas_bef [[1 ]],
8080 output_dir = rep(single_file_output , times = 2 )
8181 ),
8282 regexp = " length 1"
8383 )
8484 # Incorrect chunk size (lower than allowed).
8585 expect_error(
86- convert_file (
86+ convert (
8787 path = sas_bef [[1 ]],
8888 output_dir = single_file_output ,
8989 chunk_size = 10L
@@ -92,7 +92,7 @@ test_that("convert_file() errors with incorrect input parameters", {
9292 )
9393})
9494
95- test_that(" convert_file () partitions by year based on file name" , {
95+ test_that(" convert () partitions by year based on file name" , {
9696 expected <- fs :: path(
9797 single_file_output ,
9898 register_name ,
@@ -107,12 +107,12 @@ test_that("convert_file() partitions by year based on file name", {
107107 )
108108})
109109
110- test_that(" convert_file () creates expected n parts when chunk_size < nrow" , {
110+ test_that(" convert () creates expected n parts when chunk_size < nrow" , {
111111 chunks_path <- fs :: path_temp(" chunks_path" )
112112 chunk_size <- 10000L
113113 sas_file <- sas_bef [[1 ]]
114114
115- convert_file (
115+ convert (
116116 path = sas_file ,
117117 output_dir = chunks_path ,
118118 chunk_size = chunk_size
0 commit comments