|
1 | | -context("Study external data") |
| 1 | +if (FALSE) { |
| 2 | + context("Study external data") |
2 | 3 |
|
3 | | -if (identical(Sys.getenv("NOT_CRAN"), "true")) { |
4 | | - all_sources <- c( |
5 | | - "doi", |
6 | | - "pubmed_id", |
7 | | - "external_data_url", |
8 | | - "popset_ids", |
9 | | - "nucleotide_ids" |
10 | | - ) |
11 | | - all_data <- study_external_IDs("pg_1940") |
12 | | -} |
13 | | - |
14 | | -test_that("We can recover dois, pmids, NCBI IDs", { |
15 | | - skip_on_cran() |
16 | | - skip("NCBI seems to be down") |
17 | | - expect_that(all_data, is_a("study_external_data")) |
18 | | - expect_named(all_data) |
19 | | -}) |
| 4 | + if (identical(Sys.getenv("NOT_CRAN"), "true")) { |
| 5 | + all_sources <- c( |
| 6 | + "doi", |
| 7 | + "pubmed_id", |
| 8 | + "external_data_url", |
| 9 | + "popset_ids", |
| 10 | + "nucleotide_ids" |
| 11 | + ) |
| 12 | + all_data <- study_external_IDs("pg_1940") |
| 13 | + } |
20 | 14 |
|
21 | | -test_that("We can handle studies with missing external IDs", { |
22 | | - skip_on_cran() |
23 | | - skip("NCBI seems to be down") |
24 | | - expect_warning( |
25 | | - missing_data <- study_external_IDs("ot_97"), |
26 | | - "skipping NCBI" |
27 | | - ) |
28 | | - expect_named(missing_data) |
29 | | - expect_that(missing_data, is_a("study_external_data")) |
30 | | - expect_equal(sum(is.na(match(all_sources, names(missing_data)))), 2) # we really skipped the NCBI |
31 | | -}) |
| 15 | + test_that("We can recover dois, pmids, NCBI IDs", { |
| 16 | + skip_on_cran() |
| 17 | + skip("NCBI seems to be down") |
| 18 | + expect_that(all_data, is_a("study_external_data")) |
| 19 | + expect_named(all_data) |
| 20 | + }) |
32 | 21 |
|
33 | | -test_that("The print functions for external data objects work", { |
34 | | - skip_on_cran() |
35 | | - skip("NCBI seems to be down") |
36 | | - missing_data <- study_external_IDs("ot_91") |
37 | | - expect_output(print(all_data), "External data identifiers for study") |
38 | | - expect_output(print(missing_data), "External data identifiers for study") |
39 | | -}) |
| 22 | + test_that("We can handle studies with missing external IDs", { |
| 23 | + skip_on_cran() |
| 24 | + skip("NCBI seems to be down") |
| 25 | + expect_warning( |
| 26 | + missing_data <- study_external_IDs("ot_97"), |
| 27 | + "skipping NCBI" |
| 28 | + ) |
| 29 | + expect_named(missing_data) |
| 30 | + expect_that(missing_data, is_a("study_external_data")) |
| 31 | + expect_equal(sum(is.na(match(all_sources, names(missing_data)))), 2) # we really skipped the NCBI |
| 32 | + }) |
40 | 33 |
|
| 34 | + test_that("The print functions for external data objects work", { |
| 35 | + skip_on_cran() |
| 36 | + skip("NCBI seems to be down") |
| 37 | + missing_data <- study_external_IDs("ot_91") |
| 38 | + expect_output(print(all_data), "External data identifiers for study") |
| 39 | + expect_output(print(missing_data), "External data identifiers for study") |
| 40 | + }) |
41 | 41 |
|
42 | | -context("Taxon external data") |
| 42 | + context("Taxon external data") |
43 | 43 |
|
44 | | -test_that("We can recover external IDs for Open Tree taxa", { |
45 | | - skip_on_cran() |
46 | | - skip("NCBI seems to be down") |
47 | | - gibbon_IDs <- taxon_external_IDs(712902) |
48 | | - expect_that(gibbon_IDs, is_a("data.frame")) |
49 | | - expect_equal(names(gibbon_IDs), c("source", "id")) |
50 | | -}) |
| 44 | + test_that("We can recover external IDs for Open Tree taxa", { |
| 45 | + skip_on_cran() |
| 46 | + skip("NCBI seems to be down") |
| 47 | + gibbon_IDs <- taxon_external_IDs(712902) |
| 48 | + expect_that(gibbon_IDs, is_a("data.frame")) |
| 49 | + expect_equal(names(gibbon_IDs), c("source", "id")) |
| 50 | + }) |
| 51 | +} |
0 commit comments