tests: add test on json_data for None measures (#38913)
This commit is contained in:
parent
f93d42834e
commit
f2b6ab958a
|
@ -1,8 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
|
||||
from utils import login, get_table, get_ods_table, get_ods_document
|
||||
|
||||
from bijoe.visualization.ods import OFFICE_NS, TABLE_NS
|
||||
from bijoe.visualization.utils import Visualization
|
||||
|
||||
|
||||
def test_simple(schema1, app, admin):
|
||||
|
@ -173,3 +176,31 @@ def test_truncated_previous_year_range_on_datetime(schema1, app, admin, freezer)
|
|||
['', 'janvier', u'f\xe9vrier', 'mars', 'avril', 'mai', 'juin', 'juillet', u'ao\xfbt', 'Total'],
|
||||
['2017', '10', '1', '1', '1', '1', '1', '1', '1', '17'],
|
||||
]
|
||||
|
||||
|
||||
def test_none_percent_json_data(schema1, app, admin):
|
||||
# test conversion to Javascript declaration
|
||||
visu = Visualization.from_json({
|
||||
'warehouse': 'schema1',
|
||||
'cube': 'facts1',
|
||||
'representation': 'graphical',
|
||||
'measure': 'percent',
|
||||
'drilldown_y': 'leftcategory',
|
||||
'drilldown_x': 'date__year',
|
||||
})
|
||||
assert visu.json_data() == [
|
||||
{
|
||||
'coords': [{'value': u'2017'}, {'value': u'cat\xe92'}],
|
||||
'measures': [{'value': None}]
|
||||
},
|
||||
{
|
||||
'coords': [{'value': u'2017'}, {'value': u'cat\xe93'}],
|
||||
'measures': [{'value': None}]},
|
||||
{
|
||||
'coords': [{'value': u'2017'}, {'value': u'cat\xe91'}],
|
||||
'measures': [{'value': 94.11764705882354}]},
|
||||
{
|
||||
'coords': [{'value': u'2017'}, {'value': u'Aucun(e)'}],
|
||||
'measures': [{'value': 5.882352941176471}]
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue