Skip to content

Commit f828924

Browse files
author
Crunch.io Jenkins Account
committed
Merge remote-tracking branch 'origin/rel-6.4.435'
2 parents 492bea4 + b301521 commit f828924

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

R/cube-collapse-dimensions.R

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,18 @@ dimSums <- function(x, margin = NULL) {
6464

6565
only_count_cube <- function(cube) {
6666
# ensure that the cube is a counts cube
67-
# TODO: this should be made more robust by parsing the ZCL from the
68-
# expression instead of reaching inside
69-
measures <- cube@.Data[[1]]$measures
70-
measures_types <- lapply(measures, function(x) {
71-
return(x[["function"]])
72-
})
73-
74-
noncounts <- setdiff(measures_types, c("cube_count"))
67+
measure_types <- vapply(
68+
names(cube@arrays),
69+
function(measure) cubeMeasureType(cube, measure),
70+
character(1)
71+
)
72+
73+
noncounts <- setdiff(measure_types, c("count", ".unweighted_counts"))
7574
if (length(noncounts) > 0) {
7675
msg <- c(
7776
"You can't use CrunchCubes with measures other than count. ",
7877
"The cube you provided included measures: ",
79-
serialPaste(noncounts)
78+
serialPaste(sort(noncounts))
8079
)
8180
halt(msg)
8281
}

tests/testthat/test-cube-collapse-dimensions.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ test_that("dimSums() prevents use with non-count cubes", {
187187
dimSums(mean_cube, 1),
188188
paste0(
189189
"You can't use CrunchCubes with measures other than count. ",
190-
"The cube you provided included measures: cube_mean"
190+
"The cube you provided included measures: mean"
191191
)
192192
)
193193
})
@@ -207,7 +207,7 @@ test_that("only_cube_count() prevents use with non-count cubes", {
207207
only_count_cube(mean_cube),
208208
paste0(
209209
"You can't use CrunchCubes with measures other than count. ",
210-
"The cube you provided included measures: cube_mean"
210+
"The cube you provided included measures: mean"
211211
)
212212
)
213213
})
@@ -281,13 +281,13 @@ with_test_authentication({
281281
)
282282
})
283283

284-
test_that("only_cube_count() prevents use with non-count cubes", {
284+
test_that("only_count_cube() prevents use with non-count cubes", {
285285
multi_measures <- crtabs(list(mean(ndogs), max(ndogs)) ~ allpets + q1, data = ds)
286286
expect_error(
287287
only_count_cube(multi_measures),
288288
paste0(
289289
"You can't use CrunchCubes with measures other than count. ",
290-
"The cube you provided included measures: cube_max and cube_mean"
290+
"The cube you provided included measures: max and mean"
291291
)
292292
)
293293
})

tests/testthat/test-cube-index-table.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ test_that("index.table validation", {
128128
index.table(mean_cube, 1),
129129
paste0(
130130
"You can't use CrunchCubes with measures other than count. ",
131-
"The cube you provided included measures: cube_mean"
131+
"The cube you provided included measures: mean"
132132
)
133133
)
134134
})

tests/testthat/test-decks.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,12 +1067,12 @@ with_test_authentication({
10671067
settings <- displaySettings(analysis)
10681068
expect_is(settings, "list")
10691069
expect_equal(
1070-
names(settings),
1071-
c(
1070+
sort(names(settings)),
1071+
sort(c(
10721072
"percentageDirection", "showEmpty", "showMean", "vizType",
10731073
"countsOrPercents", "decimalPlaces", "populationMagnitude",
10741074
"showSignif", "currentTab", "uiView"
1075-
)
1075+
))
10761076
)
10771077
expect_equal(settings$countsOrPercents, "percent")
10781078
settings$countsOrPercents <- "count"

tests/testthat/test-export-dataset.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ with_test_authentication({
182182
test_that("Can download a csv of a dataset", {
183183
skip_on_local_backend("Vagrant host doesn't serve files correctly")
184184
filename <- tempfile()
185-
exportDataset(ds, file = filename)
185+
exportDataset(ds, file = filename, format = "csv")
186186
df2 <- read.csv(filename)
187187
validExport(df2)
188188
})

0 commit comments

Comments
 (0)