Skip to content

Commit

Permalink
Don't run RS_NumBands and RS_Values on all the images, otherwise addi…
Browse files Browse the repository at this point in the history
…ng new

images to raster directory will fail the tests.
  • Loading branch information
Kontinuation committed Apr 30, 2024
1 parent 8c104fc commit 200df6b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions R/tests/testthat/test-data-interface-raster.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ test_that("Passed RS_Envelope with raster", {
test_that("Passed RS_NumBands with raster", {
## Load
sdf_name <- random_string("spatial_sdf")
binary_sdf <- spark_read_binary(sc, dir = test_data("raster"), name = sdf_name)
binary_sdf <- spark_read_binary(sc, dir = test_data("raster/test3.tif"), name = sdf_name)

a <-
binary_sdf %>%
Expand All @@ -142,14 +142,11 @@ test_that("Passed RS_NumBands with raster", {
) %>%
select(nbands) %>%
collect()
print(a) # Debugging line to view the output before testing
expect_equal(
a %>% as.list(),
list(nbands = c(1, 1, 4))

list(nbands = c(4))
)


## Cleanup
sc %>% DBI::dbExecute(paste0("DROP TABLE ", sdf_name))
rm(a)
Expand Down Expand Up @@ -185,7 +182,7 @@ test_that("Passed RS_Value with raster", {
test_that("Passed RS_Values with raster", {
## Load
sdf_name <- random_string("spatial_sdf")
binary_sdf <- spark_read_binary(sc, dir = test_data("raster"), name = sdf_name)
binary_sdf <- spark_read_binary(sc, dir = test_data("raster/test1.tiff"), name = sdf_name)

a <-
binary_sdf %>%
Expand All @@ -195,10 +192,9 @@ test_that("Passed RS_Values with raster", {
) %>%
select(val) %>%
collect()
print(a)
expect_equal(
a %>% as.list(),
list(val = list(c(255, NA_real_), c(255, NA_real_), c(NA_real_, NA_real_)))
list(val = list(c(255, NA_real_)))

)

Expand Down

0 comments on commit 200df6b

Please sign in to comment.