From 2db36cf06cd6da180e4f60c2300b197d2ad1cd83 Mon Sep 17 00:00:00 2001 From: gregleleu <33321678+gregleleu@users.noreply.github.com> Date: Wed, 8 Nov 2023 09:10:36 +0100 Subject: [PATCH] Fix tests after update of dbplyr - remote_name is now a character not an "ident" - others --- R/tests/testthat/test-data-interface.R | 22 +++++++++++----------- R/tests/testthat/test-sdf-interface.R | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/tests/testthat/test-data-interface.R b/R/tests/testthat/test-data-interface.R index a12dbb1caf..4b226c9f53 100644 --- a/R/tests/testthat/test-data-interface.R +++ b/R/tests/testthat/test-data-interface.R @@ -309,7 +309,7 @@ test_that("spark_read_geoparquet() works as expected", { ) ## Right registered name - expect_equal(geoparquet_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + expect_equal(geoparquet_sdf %>% dbplyr::remote_name(), sdf_name) ## Right schema expect_equivalent( @@ -442,7 +442,7 @@ test_that("spark_read_geoparquet() throws an error with plain parquet files", { expect_error( spark_read_geoparquet(sc, geoparquet("plain.parquet")), - regexp = "GeoParquet file does not contain valid geo" + regexp = "not contain valid geo" ) }) @@ -463,7 +463,7 @@ test_that("spark_read_geojson() works as expected", { ) ## Right registered name - expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name) }) @@ -478,7 +478,7 @@ test_that("spark_read_geojson() works as expected, no feat", { ) ## Right registered name - expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name) sc %>% DBI::dbExecute(paste0("DROP TABLE ", sdf_name)) @@ -494,7 +494,7 @@ test_that("spark_read_geojson() works as expected, null values", { ) ## Right registered name - expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name) sc %>% DBI::dbExecute(paste0("DROP TABLE ", sdf_name)) @@ -522,7 +522,7 @@ test_that("spark_read_geojson() works as expected, with id", { ) ## Right registered name - expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name) sc %>% DBI::dbExecute(paste0("DROP TABLE ", sdf_name)) @@ -541,7 +541,7 @@ test_that("spark_read_geojson() works as expected, invalid geom", { ) ## Right registered name - expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name) # Remove invalid @@ -553,7 +553,7 @@ test_that("spark_read_geojson() works as expected, invalid geom", { ) ## Right registered name - expect_equal(geojson_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + expect_equal(geojson_sdf %>% dbplyr::remote_name(), sdf_name) sc %>% DBI::dbExecute(paste0("DROP TABLE ", sdf_name)) @@ -676,13 +676,13 @@ test_that("spark_write_geojson() works as expected", { ## order of columns changes ! expect_equal( - names(geojson_sdf) %>% sort(), - names(geojson_2_sdf) %>% sort() + colnames(geojson_sdf) %>% sort(), + colnames(geojson_2_sdf) %>% sort() ) expect_equal( geojson_sdf %>% mutate(geometry = geometry %>% st_astext()) %>% collect(), geojson_2_sdf %>% mutate(geometry = geometry %>% st_astext()) %>% collect() %>% - select(names(geojson_sdf)) + select(colnames(geojson_sdf)) ) diff --git a/R/tests/testthat/test-sdf-interface.R b/R/tests/testthat/test-sdf-interface.R index 8d6dd66a99..aede1a1b05 100644 --- a/R/tests/testthat/test-sdf-interface.R +++ b/R/tests/testthat/test-sdf-interface.R @@ -36,7 +36,7 @@ test_that("sdf_register() works as expected for Spatial RDDs", { ) ) - expect_equal(pt_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + expect_equal(pt_sdf %>% dbplyr::remote_name(), sdf_name) pt_sdf %>% collect() succeed() @@ -68,7 +68,7 @@ test_that("sdf_register() works as expected for Spatial RDDs with fieldNames", { ) ) - expect_equal(polygon_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + expect_equal(polygon_sdf %>% dbplyr::remote_name(), sdf_name) polygon_sdf %>% collect() succeed() @@ -91,7 +91,7 @@ test_that("as.spark.dataframe() works as expected for Spatial RDDs with non-spat attr_3 = list(name = "attr_3", type = "StringType") ) ) - expect_equal(pt_sdf %>% dbplyr::remote_name(), dbplyr::ident(sdf_name)) + expect_equal(pt_sdf %>% dbplyr::remote_name(), sdf_name) pt_sdf %>% collect() succeed()