Skip to content

Commit

Permalink
update sas/spss/stata tests for new attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
SInginc committed Sep 9, 2023
1 parent 7997072 commit 356848d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/testthat/test-haven-sas.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ test_that("can roundtrip format attribute", {
e = structure(100.12345, format.sas = "COMMA10.3")
)

attr(df, "creation_timestamp") <- as.integer(Sys.time())
attr(df, "modified_timestamp") <- as.integer(Sys.time())

path <- tempfile()

write_xpt(df, path)
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-haven-spss.R
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ test_that("works with empty factors", {

test_that("all compression types roundtrip successfully", {
df <- tibble::tibble(x = 1:10)
attr(df, "encoding") <- "UTF-8"
attr(df, "creation_timestamp") <- as.integer(Sys.time())
attr(df, "modified_timestamp") <- as.integer(Sys.time())
expect_equal(roundtrip_sav(df, compress = "byte"), df)
expect_equal(roundtrip_sav(df, compress = "none"), df)
expect_equal(roundtrip_sav(df, compress = "zsav"), df)
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-haven-stata.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ test_that("supports stata version 15", {

df2$x <- as_factor(df2$x)
df2$y <- zap_formats(df2$y)

attr(df, "creation_timestamp") <- as.integer(Sys.time())
attr(df, "modified_timestamp") <- as.integer(Sys.time())

expect_equal(df2, df)
})

Expand Down

0 comments on commit 356848d

Please sign in to comment.