Skip to content

Commit e6c2346

Browse files
committed
fix tests
1 parent 9b67c37 commit e6c2346

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎R/table_utils.R‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ setMethod("hasTable", c("SpatialData", "character"), \(x, i, name=FALSE) {
100100
t <- lapply(tables(x), \(t) meta(t)$region)
101101
ok <- rapply(t, \(.) i %in% ., "character")
102102
# failure when no/many matches
103-
if (!name) return(any(ok))
104-
if (!any(ok)) stop("no 'table' found for 'i'")
105-
if (sum(ok) > 0) stop("multiple 'table's found for 'i'")
103+
if (name) {
104+
if (!any(ok)) stop("no 'table' found for 'i'")
105+
if (sum(ok) > 1) stop("multiple 'table's found for 'i'")
106+
return(names(t)[ok])
107+
}
108+
return(any(ok))
106109
})
107110

108111
# get ----

0 commit comments

Comments
 (0)