Skip to content

Commit 3247d7c

Browse files
authored
Fix partial match argument (#139)
1 parent ab426e9 commit 3247d7c

File tree

4 files changed

+122
-2
lines changed

4 files changed

+122
-2
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Suggests:
2929
stringr,
3030
devtools,
3131
covr,
32-
bit64
32+
bit64,
33+
withr
3334
RoxygenNote: 7.3.2
3435
Roxygen: list(markdown = TRUE)
3536
VignetteBuilder: knitr

R/identify.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ identify_differences <- function(
239239
x = BASE,
240240
y = COMP,
241241
by = KEYS,
242-
suffix = c(".x", ".y"),
242+
suffixes = c(".x", ".y"),
243243
sort = TRUE
244244
)
245245
if (nrow(DAT) == 0) {

tests/testthat/_snaps/miscellaneous.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,50 @@
383383
384384
385385

386+
---
387+
388+
Code
389+
diffdf(d5, d6, suppress_warnings = TRUE)
390+
Output
391+
Differences found between the objects!
392+
393+
Summary of BASE and COMPARE
394+
==================================================================
395+
PROPERTY BASE COMP
396+
------------------------------------------------------------------
397+
Name d5 d6
398+
Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
399+
Rows(#) 50 50
400+
Columns(#) 2 2
401+
------------------------------------------------------------------
402+
403+
404+
Not all Values Compared Equal
405+
=============================
406+
Variable No of Differences
407+
-----------------------------
408+
dt1 25
409+
-----------------------------
410+
411+
412+
First 10 of 25 rows are shown in table below
413+
===========================================================
414+
VARIABLE ..ROWNUMBER.. BASE COMPARE
415+
-----------------------------------------------------------
416+
dt1 1 2010-11-19 19:39:15 UTC <NA>
417+
dt1 3 1960-10-01 07:07:59 UTC <NA>
418+
dt1 5 2056-01-25 04:51:33 UTC <NA>
419+
dt1 7 2013-04-15 17:26:08 UTC <NA>
420+
dt1 9 2047-04-11 19:04:11 UTC <NA>
421+
dt1 11 2015-04-02 04:50:42 UTC <NA>
422+
dt1 13 2022-03-16 00:42:50 UTC <NA>
423+
dt1 15 1998-05-18 10:16:14 UTC <NA>
424+
dt1 17 1981-05-17 14:42:57 UTC <NA>
425+
dt1 19 1972-08-09 04:01:06 UTC <NA>
426+
-----------------------------------------------------------
427+
428+
429+
386430
# `as_ascii_table() can handle missing dates (#132)
387431

388432
Code
@@ -461,3 +505,47 @@
461505
462506
463507

508+
---
509+
510+
Code
511+
diffdf(d5, d6, suppress_warnings = TRUE)
512+
Output
513+
Differences found between the objects!
514+
515+
Summary of BASE and COMPARE
516+
==================================================================
517+
PROPERTY BASE COMP
518+
------------------------------------------------------------------
519+
Name d5 d6
520+
Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
521+
Rows(#) 50 50
522+
Columns(#) 2 2
523+
------------------------------------------------------------------
524+
525+
526+
Not all Values Compared Equal
527+
=============================
528+
Variable No of Differences
529+
-----------------------------
530+
dt1 25
531+
-----------------------------
532+
533+
534+
First 10 of 25 rows are shown in table below
535+
==============================================
536+
VARIABLE ..ROWNUMBER.. BASE COMPARE
537+
----------------------------------------------
538+
dt1 1 2094-01-18 <NA>
539+
dt1 3 1660-11-17 <NA>
540+
dt1 5 2484-06-02 <NA>
541+
dt1 7 2114-10-26 <NA>
542+
dt1 9 2408-06-23 <NA>
543+
dt1 11 2131-10-07 <NA>
544+
dt1 13 2191-11-05 <NA>
545+
dt1 15 1985-12-25 <NA>
546+
dt1 17 1839-02-01 <NA>
547+
dt1 19 1763-04-22 <NA>
548+
----------------------------------------------
549+
550+
551+

tests/testthat/test-miscellaneous.R

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,38 @@ test_that("datetimes compare as expected", {
254254
})
255255

256256

257+
testthat::test_that("#138 - No partial arg matches", {
258+
withr::local_options(
259+
list(
260+
warnPartialMatchArgs = TRUE,
261+
warnPartialMatchDollar = TRUE,
262+
warnPartialMatchAttr = TRUE
263+
)
264+
)
265+
266+
df1 <- data.frame(
267+
index1 = c(0, 0, 1, 1),
268+
index2 = c(1, 2, 1, 2),
269+
value = c(1, 2, 3, 4),
270+
value2 = c(1, 2, 3, 4)
271+
)
257272

273+
df2 <- data.frame(
274+
index1 = c(1, 1, 2, 2),
275+
index2 = c(1, 2, 1, 2),
276+
value = c(0, 1, 20, 3),
277+
value2 = c(0, 1, 2, 333)
278+
)
279+
280+
expect_no_condition({
281+
diff_result <- diffdf::diffdf(
282+
df1,
283+
df2,
284+
keys = c("index1", "index2"),
285+
suppress_warnings = TRUE
286+
)
287+
})
288+
})
258289

259290
test_that("`as_ascii_table() can handle missing datetimes (#132)", {
260291
d1 <- tibble(

0 commit comments

Comments
 (0)