-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#154065274]: Added means tests, fix CA cases
- Loading branch information
1 parent
73aedff
commit dccc95c
Showing
12 changed files
with
5,086 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os | ||
from functools import partial | ||
|
||
from cr.cube.utils import load_fixture | ||
|
||
CUBES_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
||
def _load(cube_file): | ||
load = partial(load_fixture, CUBES_DIR) | ||
return load(cube_file) | ||
|
||
|
||
CA_CAT_X_ITEMS = _load('ca-cat-x-items.json') | ||
CA_ITEMS_X_CAT = _load('ca-items-x-cat.json') | ||
CA_X_MR = _load('ca-x-mr.json') | ||
CAT_X_CA_CAT_X_ITEMS = _load('cat-x-ca-cat-x-items.json') | ||
CAT_X_CAT = _load('cat-x-cat.json') | ||
CAT_X_MR = _load('cat-x-mr.json') | ||
MR_X_CAT = _load('mr-x-cat.json') | ||
UNIVARIATE_CAT = _load('univariate-cat.json') |
513 changes: 513 additions & 0 deletions
513
tests/integration/fixtures/cubes/scale_means/ca-cat-x-items.json
Large diffs are not rendered by default.
Oops, something went wrong.
513 changes: 513 additions & 0 deletions
513
tests/integration/fixtures/cubes/scale_means/ca-items-x-cat.json
Large diffs are not rendered by default.
Oops, something went wrong.
1,390 changes: 1,390 additions & 0 deletions
1,390
tests/integration/fixtures/cubes/scale_means/ca-x-mr.json
Large diffs are not rendered by default.
Oops, something went wrong.
1,033 changes: 1,033 additions & 0 deletions
1,033
tests/integration/fixtures/cubes/scale_means/cat-x-ca-cat-x-items.json
Large diffs are not rendered by default.
Oops, something went wrong.
308 changes: 308 additions & 0 deletions
308
tests/integration/fixtures/cubes/scale_means/cat-x-cat.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,308 @@ | ||
{ | ||
"element": "shoji:view", | ||
"self": "https://app.crunch.io/api/datasets/ddc1b8a25c454689911d3d7a59c97aee/cube/?filter=%7B%22filter%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2Fddc1b8a25c454689911d3d7a59c97aee%2Ffilters%2F06b4deb17519405ebe4581dd8dbe9eba%2F%22%7D&query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2Fddc1b8a25c454689911d3d7a59c97aee%2Fvariables%2F000026%2F%22%7D,%7B%22variable%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2Fddc1b8a25c454689911d3d7a59c97aee%2Fvariables%2F000067%2F%22%7D%5D,%22measures%22:%7B%22count%22:%7B%22function%22:%22cube_count%22,%22args%22:%5B%5D%7D%7D,%22weight%22:null%7D", | ||
"value": { | ||
"query": { | ||
"measures": { | ||
"count": { | ||
"function": "cube_count", | ||
"args": [] | ||
} | ||
}, | ||
"dimensions": [ | ||
{ | ||
"variable": "https://app.crunch.io/api/datasets/ddc1b8a25c454689911d3d7a59c97aee/variables/000026/" | ||
}, | ||
{ | ||
"variable": "https://app.crunch.io/api/datasets/ddc1b8a25c454689911d3d7a59c97aee/variables/000067/" | ||
} | ||
], | ||
"weight": null | ||
}, | ||
"query_environment": { | ||
"filter": [ | ||
"https://app.crunch.io/api/datasets/ddc1b8a25c454689911d3d7a59c97aee/filters/06b4deb17519405ebe4581dd8dbe9eba/" | ||
] | ||
}, | ||
"result": { | ||
"dimensions": [ | ||
{ | ||
"references": { | ||
"alias": "pasta", | ||
"notes": "A categorical variable", | ||
"name": "Shapes of pasta", | ||
"description": "The geometry of pasta" | ||
}, | ||
"derived": false, | ||
"type": { | ||
"ordinal": false, | ||
"class": "categorical", | ||
"categories": [ | ||
{ | ||
"numeric_value": 1, | ||
"missing": false, | ||
"id": 1, | ||
"name": "Bucatini" | ||
}, | ||
{ | ||
"numeric_value": 2, | ||
"missing": false, | ||
"id": 2, | ||
"name": "Chitarra" | ||
}, | ||
{ | ||
"numeric_value": 0, | ||
"missing": false, | ||
"id": 0, | ||
"name": "Boccoli" | ||
}, | ||
{ | ||
"numeric_value": 4, | ||
"missing": false, | ||
"id": 4, | ||
"name": "Orecchiette" | ||
}, | ||
{ | ||
"numeric_value": 5, | ||
"missing": false, | ||
"id": 5, | ||
"name": "Quadrefiore" | ||
}, | ||
{ | ||
"numeric_value": 6, | ||
"missing": false, | ||
"id": 6, | ||
"name": "Fileja" | ||
}, | ||
{ | ||
"numeric_value": 32766, | ||
"missing": true, | ||
"id": 32766, | ||
"name": "Skipped" | ||
}, | ||
{ | ||
"numeric_value": 32767, | ||
"missing": true, | ||
"id": 32767, | ||
"name": "Not asked" | ||
}, | ||
{ | ||
"numeric_value": null, | ||
"missing": true, | ||
"id": -1, | ||
"name": "No Data" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"references": { | ||
"alias": "food_groups", | ||
"notes": "A categorical variable where the missing categories are interspersed throughout the non-missing categories", | ||
"name": "Food groups", | ||
"description": "Four of the five USDA food groups" | ||
}, | ||
"derived": false, | ||
"type": { | ||
"ordinal": false, | ||
"class": "categorical", | ||
"categories": [ | ||
{ | ||
"numeric_value": 0, | ||
"missing": false, | ||
"id": 0, | ||
"name": "Vegetables" | ||
}, | ||
{ | ||
"numeric_value": 32766, | ||
"missing": true, | ||
"id": 32766, | ||
"name": "Don't know" | ||
}, | ||
{ | ||
"numeric_value": 2, | ||
"missing": false, | ||
"id": 2, | ||
"name": "Fruit" | ||
}, | ||
{ | ||
"numeric_value": 5, | ||
"missing": false, | ||
"id": 5, | ||
"name": "Grain" | ||
}, | ||
{ | ||
"numeric_value": null, | ||
"missing": true, | ||
"id": -1, | ||
"name": "No Data" | ||
}, | ||
{ | ||
"numeric_value": 4, | ||
"missing": false, | ||
"id": 4, | ||
"name": "Meat" | ||
}, | ||
{ | ||
"numeric_value": 32767, | ||
"missing": true, | ||
"id": 32767, | ||
"name": "Not asked" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"missing": 10, | ||
"measures": { | ||
"count": { | ||
"data": [ | ||
31, | ||
0, | ||
8, | ||
3, | ||
0, | ||
12, | ||
0, | ||
31, | ||
0, | ||
45, | ||
27, | ||
0, | ||
21, | ||
0, | ||
156, | ||
3, | ||
217, | ||
129, | ||
0, | ||
105, | ||
0, | ||
66, | ||
0, | ||
101, | ||
59, | ||
0, | ||
80, | ||
0, | ||
92, | ||
1, | ||
68, | ||
47, | ||
0, | ||
188, | ||
0, | ||
49, | ||
2, | ||
51, | ||
25, | ||
0, | ||
23, | ||
0, | ||
3, | ||
0, | ||
1, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0 | ||
], | ||
"n_missing": 10, | ||
"metadata": { | ||
"references": {}, | ||
"derived": true, | ||
"type": { | ||
"integer": true, | ||
"missing_rules": {}, | ||
"missing_reasons": { | ||
"No Data": -1 | ||
}, | ||
"class": "numeric" | ||
} | ||
} | ||
} | ||
}, | ||
"element": "crunch:cube", | ||
"counts": [ | ||
31, | ||
0, | ||
8, | ||
3, | ||
0, | ||
12, | ||
0, | ||
31, | ||
0, | ||
45, | ||
27, | ||
0, | ||
21, | ||
0, | ||
156, | ||
3, | ||
217, | ||
129, | ||
0, | ||
105, | ||
0, | ||
66, | ||
0, | ||
101, | ||
59, | ||
0, | ||
80, | ||
0, | ||
92, | ||
1, | ||
68, | ||
47, | ||
0, | ||
188, | ||
0, | ||
49, | ||
2, | ||
51, | ||
25, | ||
0, | ||
23, | ||
0, | ||
3, | ||
0, | ||
1, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0 | ||
], | ||
"n": 1644 | ||
} | ||
} | ||
} |
Oops, something went wrong.