You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2023/04/17 12:58:55 UTC

[GitHub] [arrow] paleolimbot commented on a diff in pull request #35172: GH-35035: [R] Implement names<- for Schemas

paleolimbot commented on code in PR #35172:
URL: https://github.com/apache/arrow/pull/35172#discussion_r1168653779


##########
r/tests/testthat/test-schema.R:
##########
@@ -260,3 +260,22 @@ test_that("as_schema() works for StructType objects", {
   struct_type <- struct(col1 = int32())
   expect_equal(as_schema(struct_type), schema(col1 = int32()))
 })
+
+test_that("schema name assignment", {
+  schm <- schema(x = int8(), y = string(), z = double())
+  expect_identical(names(schm), c("x", "y", "z"))
+  names(schm) <- c("a", "b", "c")
+  expect_identical(names(schm), c("a", "b", "c"))
+  expect_error(names(schm) <- "f")
+  expect_error(names(schm) <- letters)
+  expect_error(names(schm) <- character(0))
+  expect_error(names(schm) <- NULL)
+  expect_error(names(schm) <- c(TRUE, FALSE))

Review Comment:
   Can you either add a regex for these or use `expect_snapshot()` to ensure that we aren't swallowing an unrelated error here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org