Skip to content

Commit

Permalink
Merge pull request #10 from Tmonster/new_csv_test_na_strings
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr authored Feb 24, 2024
2 parents 1d54154 + de3dd41 commit 4a82721
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/testthat/test_read.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,21 @@ test_that("duckdb_read_csv() works as expected", {
res$Species <- as.factor(res$Species)
expect_true(identical(res, iris))

# test better na.strings handling
# see https://github.com/duckdb/duckdb/issues/8590
tf3 <- tempfile()
csv <- c(
'"num","char","logi","lisst.1","lisst.2","lisst.3","lisst.NA"',
'0.5,"yes",TRUE,1,2,3,NA',
'2,"no",FALSE,1,2,3,NA',
'NA,NA,NA,1,2,3,NA'
)
writeLines(csv, tf3)
duckdb_read_csv(con, "na_table", tf3, na.strings = "-")
expect_identical(
dbReadTable(con, "na_table"),
read.csv(tf3, na.strings = "-")
)

dbDisconnect(con, shutdown = TRUE)
})
})

0 comments on commit 4a82721

Please sign in to comment.