Skip to content

Commit

Permalink
Merge pull request #106 from natverse/fix/spine-details-tests
Browse files Browse the repository at this point in the history
Warn when trying to fetch synapse details from spine
  • Loading branch information
jefferis committed Mar 13, 2021
2 parents 69b8c0d + 62145b9 commit 6ff51cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
11 changes: 8 additions & 3 deletions R/autosyn.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ flywire_partners <- function(rootid, partners=c("outputs", "inputs", "both"),
}

if(isTRUE(details)) {
synlinks=synlinks_tbl(local=local)
if(is.null(synlinks))
stop("I cannot find the Buhmann sqlite database required when details=TRUE!")
if(method=='spine') {
details=FALSE
warning("Unable to fetch all synapse details when method='spine'")
} else {
synlinks=synlinks_tbl(local=local)
if(is.null(synlinks))
stop("I cannot find the Buhmann sqlite database required when details=TRUE!")
}
}

if(length(rootid)>1) {
Expand Down
16 changes: 5 additions & 11 deletions tests/testthat/test-autosyn.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ test_that("flywire_partners / flywire_partner_summary works", {

expect_warning(flywire_partners(c(kcs[1],kcs[1])), "duplicate")

# check for equivalence of sqlite and spine methods if we have sqlite
skip_if(is.null(synlinks_tbl()), "Skipping tests relying on sqlite databases")

both.details=flywire_partners("720575940616243077", partners = 'both', details=T)
both.spine=flywire_partners("720575940616243077", partners = 'both', details=T,
method = 'spine')
expect_equal(both.details, both.spine)

top5in = c(
"720575940625862385",
"720575940609920691",
Expand Down Expand Up @@ -83,9 +75,9 @@ test_that("flywire_partners / flywire_partner_summary works", {
skip_if(is.null(synlinks_tbl()), "Skipping tests relying on sqlite databases")

both.details=flywire_partners("720575940616243077", partners = 'both', details=T)
both.spine=flywire_partners("720575940616243077", partners = 'both', details=T,
method = 'spine')

expect_warning(both.spine <- flywire_partners("720575940616243077", partners = 'both', details=T,
method = 'spine'))
expect_equal(both.details[colnames(both.spine)], both.spine)
})

test_that("flywire_ntpred+flywire_ntplot works", {
Expand Down Expand Up @@ -137,6 +129,8 @@ test_that("fafbseg.sqlitepath is respected",{
})

test_that("flywire_neurons_add_synapses works", {
skip_if(is.null(synlinks_tbl()),
"Skipping flywire_neurons_add_synapses test as no synlinks sqlite db!")
token=try(chunkedgraph_token(), silent = TRUE)
skip_if_not_installed('reticulate')
skip_if(inherits(token, "try-error"),"Skipping live flywire tests")
Expand Down

0 comments on commit 6ff51cb

Please sign in to comment.