Skip to content

Commit

Permalink
GH-37950: [R] tests fail on R < 4.0 due to test calling data.frame() …
Browse files Browse the repository at this point in the history
…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 <thisisnic@gmail.com>
Signed-off-by: Nic Crane <thisisnic@gmail.com>
  • Loading branch information
thisisnic committed Sep 29, 2023
1 parent c703b87 commit 1415598
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion r/tests/testthat/test-schema.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1415598

Please sign in to comment.