1
- # make sure deprecated warnings are always thrown- bypass 8 hour suppression
2
- rlang :: local_options(lifecycle_verbosity = " warning" )
1
+ # We can't use expect_warning() without adding a dependency to rlang
2
+ # to bypass 8 hour warning suppression
3
+ # rlang::local_options(lifecycle_verbosity = "warning")
3
4
4
5
test_that(" validate_args throws errors for all bad args" , {
5
6
skip_on_cran()
@@ -13,36 +14,40 @@ test_that("validate_args throws errors for all bad args", {
13
14
search_pv(' {"patent_date":["1976-01-06"]}' , method = " Post" ),
14
15
" method"
15
16
)
16
- expect_warning(
17
- search_pv(' {"patent_date":["1976-01-06"]}' , subent_cnts = TRUE ),
18
- class = " lifecycle_warning_deprecated"
19
- )
20
- expect_warning(
21
- search_pv(' {"patent_date":["1976-01-06"]}' , subent_cnts = 7 ),
22
- class = " lifecycle_warning_deprecated"
23
- )
24
- expect_warning(
25
- search_pv(' {"patent_date":["1976-01-06"]}' , mtchd_subent_only = NULL ),
26
- class = " lifecycle_warning_deprecated"
27
- )
28
- expect_warning(
29
- search_pv(' {"patent_date":["1976-01-06"]}' , error_browser = " chrome" ),
30
- class = " lifecycle_warning_deprecated"
31
- )
17
+ suppressWarnings({
18
+ result <- search_pv(' {"patent_date":["1976-01-06"]}' , subent_cnts = TRUE )
19
+ # class = "lifecycle_warning_deprecated"
20
+ expect_gt(result $ query_results $ total_hits , 0 )
21
+ })
22
+ suppressWarnings({
23
+ result <- search_pv(' {"patent_date":["1976-01-06"]}' , subent_cnts = 7 )
24
+ # class = "lifecycle_warning_deprecated"
25
+ expect_gt(result $ query_results $ total_hits , 0 )
26
+ })
27
+ suppressWarnings({
28
+ result <- search_pv(' {"patent_date":["1976-01-06"]}' , mtchd_subent_only = NULL )
29
+ # class = "lifecycle_warning_deprecated"
30
+ expect_gt(result $ query_results $ total_hits , 0 )
31
+ })
32
+ suppressWarnings({
33
+ result <- search_pv(' {"patent_date":["1976-01-06"]}' , error_browser = " chrome" )
34
+ # class = "lifecycle_warning_deprecated"
35
+ expect_gt(result $ query_results $ total_hits , 0 )
36
+ })
32
37
33
38
per_page <- 17
34
- expect_warning(
35
- results <- search_pv(' {"patent_date":["1976-01-06"]}' , per_page = per_page ),
36
- class = " lifecycle_warning_deprecated"
37
- )
39
+ suppressWarnings({
40
+ results <- search_pv(' {"patent_date":["1976-01-06"]}' , per_page = per_page )
38
41
39
- # make sure the size attribute was set from the per_page parameter
40
- expect_equal(per_page , nrow(results $ data $ patents ))
42
+ # make sure the size attribute was set from the per_page parameter
43
+ expect_equal(per_page , nrow(results $ data $ patents ))
44
+ })
41
45
42
- expect_warning(
43
- search_pv(' {"patent_date":["1976-01-06"]}' , page = 2 ),
44
- class = " lifecycle_warning_deprecated" # unsupported page parameter
45
- )
46
+ suppressWarnings({
47
+ result <- search_pv(' {"patent_date":["1976-01-06"]}' , page = 2 )
48
+ # class = "lifecycle_warning_deprecated" # unsupported page parameter
49
+ expect_gt(result $ query_results $ total_hits , 0 )
50
+ })
46
51
expect_error(
47
52
search_pv(
48
53
' {"patent_date":["1976-01-06"]}' ,
@@ -58,17 +63,6 @@ test_that("validate_args throws errors for all bad args", {
58
63
)
59
64
})
60
65
61
- test_that(" per_page parameter warns but still works" , {
62
- skip_on_cran()
63
-
64
- expect_warning(
65
- results <- search_pv(' {"patent_date":["1976-01-06"]}' , per_page = 23 ),
66
- class = " lifecycle_warning_deprecated"
67
- )
68
-
69
- expect_equal(23 , nrow(results $ data $ patents ))
70
- })
71
-
72
66
test_that(" group names can be requested as fields via new API shorthand" , {
73
67
skip_on_cran()
74
68
0 commit comments