Skip to content

Commit 8fe9f0c

Browse files
author
Sun Rui
committed
Update the pattern 'expect_true(identical(a, b))' to 'expect_identical(a, b)'.
1 parent f1b8005 commit 8fe9f0c

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

R/pkg/inst/tests/test_sparkSQL.R

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -851,58 +851,58 @@ test_that("dropna() on a DataFrame", {
851851

852852
expected <- rows[!is.na(rows$name),]
853853
actual <- collect(dropna(df, cols = "name"))
854-
expect_true(identical(expected, actual))
854+
expect_identical(expected, actual)
855855

856856
expected <- rows[!is.na(rows$age),]
857857
actual <- collect(dropna(df, cols = "age"))
858858
row.names(expected) <- row.names(actual)
859859
# identical on two dataframes does not work here. Don't know why.
860860
# use identical on all columns as a workaround.
861-
expect_true(identical(expected$age, actual$age))
862-
expect_true(identical(expected$height, actual$height))
863-
expect_true(identical(expected$name, actual$name))
861+
expect_identical(expected$age, actual$age)
862+
expect_identical(expected$height, actual$height)
863+
expect_identical(expected$name, actual$name)
864864

865865
expected <- rows[!is.na(rows$age) & !is.na(rows$height),]
866866
actual <- collect(dropna(df, cols = c("age", "height")))
867-
expect_true(identical(expected, actual))
867+
expect_identical(expected, actual)
868868

869869
expected <- rows[!is.na(rows$age) & !is.na(rows$height) & !is.na(rows$name),]
870870
actual <- collect(dropna(df))
871-
expect_true(identical(expected, actual))
871+
expect_identical(expected, actual)
872872

873873
# drop with how
874874

875875
expected <- rows[!is.na(rows$age) & !is.na(rows$height) & !is.na(rows$name),]
876876
actual <- collect(dropna(df))
877-
expect_true(identical(expected, actual))
877+
expect_identical(expected, actual)
878878

879879
expected <- rows[!is.na(rows$age) | !is.na(rows$height) | !is.na(rows$name),]
880880
actual <- collect(dropna(df, "all"))
881-
expect_true(identical(expected, actual))
881+
expect_identical(expected, actual)
882882

883883
expected <- rows[!is.na(rows$age) & !is.na(rows$height) & !is.na(rows$name),]
884884
actual <- collect(dropna(df, "any"))
885-
expect_true(identical(expected, actual))
885+
expect_identical(expected, actual)
886886

887887
expected <- rows[!is.na(rows$age) & !is.na(rows$height),]
888888
actual <- collect(dropna(df, "any", cols = c("age", "height")))
889-
expect_true(identical(expected, actual))
889+
expect_identical(expected, actual)
890890

891891
expected <- rows[!is.na(rows$age) | !is.na(rows$height),]
892892
actual <- collect(dropna(df, "all", cols = c("age", "height")))
893-
expect_true(identical(expected, actual))
893+
expect_identical(expected, actual)
894894

895895
# drop with threshold
896896

897897
expected <- rows[as.integer(!is.na(rows$age)) + as.integer(!is.na(rows$height)) >= 2,]
898898
actual <- collect(dropna(df, minNonNulls = 2, cols = c("age", "height")))
899-
expect_true(identical(expected, actual))
899+
expect_identical(expected, actual)
900900

901901
expected <- rows[as.integer(!is.na(rows$age)) +
902902
as.integer(!is.na(rows$height)) +
903903
as.integer(!is.na(rows$name)) >= 3,]
904904
actual <- collect(dropna(df, minNonNulls = 3, cols = c("name", "age", "height")))
905-
expect_true(identical(expected, actual))
905+
expect_identical(expected, actual)
906906
})
907907

908908
test_that("fillna() on a DataFrame", {
@@ -915,22 +915,22 @@ test_that("fillna() on a DataFrame", {
915915
expected$age[is.na(expected$age)] <- 50
916916
expected$height[is.na(expected$height)] <- 50.6
917917
actual <- collect(fillna(df, 50.6))
918-
expect_true(identical(expected, actual))
918+
expect_identical(expected, actual)
919919

920920
expected <- rows
921921
expected$name[is.na(expected$name)] <- "unknown"
922922
actual <- collect(fillna(df, "unknown"))
923-
expect_true(identical(expected, actual))
923+
expect_identical(expected, actual)
924924

925925
expected <- rows
926926
expected$age[is.na(expected$age)] <- 50
927927
actual <- collect(fillna(df, 50.6, "age"))
928-
expect_true(identical(expected, actual))
928+
expect_identical(expected, actual)
929929

930930
expected <- rows
931931
expected$name[is.na(expected$name)] <- "unknown"
932932
actual <- collect(fillna(df, "unknown", c("age", "name")))
933-
expect_true(identical(expected, actual))
933+
expect_identical(expected, actual)
934934

935935
# fill with named list
936936

@@ -939,7 +939,7 @@ test_that("fillna() on a DataFrame", {
939939
expected$height[is.na(expected$height)] <- 50.6
940940
expected$name[is.na(expected$name)] <- "unknown"
941941
actual <- collect(fillna(df, list("age" = 50, "height" = 50.6, "name" = "unknown")))
942-
expect_true(identical(expected, actual))
942+
expect_identical(expected, actual)
943943
})
944944

945945
unlink(parquetPath)

0 commit comments

Comments
 (0)