Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 28, 2022
1 parent 1552145 commit 89e8193
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/testthat/test-data_read.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,38 @@ unlink(temp_file)



# SPSS file. 2 ---------------------------------

temp_file <- tempfile(fileext = ".sav")
request <- httr::GET("https://raw.github.com/easystats/circus/master/data/spss_test.sav")
httr::stop_for_status(request)
writeBin(httr::content(request, type = "raw"), temp_file)

test_that("data_read", {
d <- data_read(temp_file)
expect_equal(
d,
structure(list(
V1 = structure(
1:4, levels = c("Eins", "Zwei", "Drei", "Vier"),
class = "factor", label = "Variable 1"
),
V2 = structure(
c(2, 3, 4, 1), labels = c(Eins = 1, Zwei = 2, Drei = 3),
label = "Variable 2"
),
V3 = structure(
c(3L, 2L, 1L, 4L), levels = c("Eins", "Zwei", "Drei", "Vier"),
class = "factor", label = "Variable 3"
)),
row.names = c(NA, -4L), class = "data.frame")
)
})

unlink(temp_file)



# zipped SPSS file -----------------------------------

temp_file <- tempfile(fileext = ".zip")
Expand Down

0 comments on commit 89e8193

Please sign in to comment.