This is an automated email from the ASF dual-hosted git repository.

thisisnic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 141559816e GH-37950: [R] tests fail on R < 4.0 due to test calling 
data.frame() without specifying stringsAsFactors=FALSE (#37951)
141559816e is described below

commit 141559816eea8474ed96680a60eceae574d499c3
Author: Nic Crane <[email protected]>
AuthorDate: Fri Sep 29 13:31:38 2023 +0100

    GH-37950: [R] tests fail on R < 4.0 due to test calling data.frame() 
without specifying stringsAsFactors=FALSE (#37951)
    
    ### Rationale for this change
    
    Tests failing on R < 4.0 builds due to the default value of the the 
`data.frame()` parameter `stringsAsFactors` between older and newer versions of 
R
    
    ### What changes are included in this PR?
    
    Update a test using `data.frame()` to manually specify the value of 
`stringsAsFactors` as `FALSE`.
    
    ### Are these changes tested?
    
    No
    
    ### Are there any user-facing changes?
    
    No
    * Closes: #37950
    
    Authored-by: Nic Crane <[email protected]>
    Signed-off-by: Nic Crane <[email protected]>
---
 r/tests/testthat/test-schema.R | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/r/tests/testthat/test-schema.R b/r/tests/testthat/test-schema.R
index b1dc065929..15342add38 100644
--- a/r/tests/testthat/test-schema.R
+++ b/r/tests/testthat/test-schema.R
@@ -300,7 +300,11 @@ test_that("schema extraction", {
   expect_equal(schema(example_data), tbl$schema)
   expect_equal(schema(tbl), tbl$schema)
 
-  expect_equal(schema(data.frame(a = 1, a = "x", check.names = FALSE)), 
schema(a = double(), a = string()))
+  expect_equal(
+    schema(data.frame(a = 1, a = "x", check.names = FALSE, stringsAsFactors = 
FALSE)),
+    schema(a = double(), a = string())
+  )
+
   expect_equal(schema(data.frame()), schema())
 
   ds <- InMemoryDataset$create(example_data)

Reply via email to