tests: format dataviz using black (#49173)

This commit is contained in:
Valentin Deniaud 2020-11-26 16:32:09 +01:00
parent de584c394f
commit 5db0931f10
1 changed files with 18 additions and 51 deletions

View File

@ -16,6 +16,7 @@ from .test_public import login, normal_user
pytestmark = pytest.mark.django_db
@pytest.fixture
def cell():
page = Page(title='One', slug='index')
@ -133,9 +134,7 @@ def bijoe_mock(url, request):
response = {
'format': '1',
'data': [222, 134, 0, 53],
'axis': {
'x_labels': ['web', 'mail', 'phone', 'email']
},
'axis': {'x_labels': ['web', 'mail', 'phone', 'email']},
'measure': 'integer',
}
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
@ -143,23 +142,15 @@ def bijoe_mock(url, request):
response = {
'format': '1',
'data': [222, 134, 0, 53],
'axis': {
'y_labels': ['web', 'mail', 'phone', 'email']
},
'axis': {'y_labels': ['web', 'mail', 'phone', 'email']},
'measure': 'integer',
}
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
if url.path == '/visualization/3/json/':
response = {
'format': '1',
'data': [
[222, 134, 0, 53],
[122, 114, 2, 33],
],
'axis': {
'x_labels': ['web', 'mail', 'phone', 'email'],
'y_labels': ['foo', 'bar'],
},
'data': [[222, 134, 0, 53], [122, 114, 2, 33],],
'axis': {'x_labels': ['web', 'mail', 'phone', 'email'], 'y_labels': ['foo', 'bar'],},
'measure': 'integer',
}
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
@ -174,27 +165,15 @@ def bijoe_mock(url, request):
if url.path == '/visualization/5/json/':
response = {
'format': '1',
'data': [
[222, 134, 0, 53],
[122, 114, 2, 33],
],
'axis': {
'x_labels': ['web', 'mail', 'phone', 'email'],
'loop': ['foo', 'bar'],
}
'data': [[222, 134, 0, 53], [122, 114, 2, 33],],
'axis': {'x_labels': ['web', 'mail', 'phone', 'email'], 'loop': ['foo', 'bar'],},
}
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
if url.path == '/visualization/6/json/':
response = {
'format': '1',
'data': [
[222, 134, 0, 53],
[122, 114, 2, 33],
],
'axis': {
'y_labels': ['web', 'mail', 'phone', 'email'],
'loop': ['foo', 'bar'],
}
'data': [[222, 134, 0, 53], [122, 114, 2, 33],],
'axis': {'y_labels': ['web', 'mail', 'phone', 'email'], 'loop': ['foo', 'bar'],},
}
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
if url.path == '/visualization/7/json/':
@ -210,16 +189,14 @@ def bijoe_mock(url, request):
'x_labels': ['foo', 'bar'],
'y_labels': ['web', 'mail', 'phone', 'email'],
'loop': ['a', 'b', 'c', 'd'],
}
},
}
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
if url.path == '/visualization/8/json/':
response = {
'format': '1',
'data': [1000, 123000, 8600, 86400],
'axis': {
'y_labels': ['web', 'mail', 'email', 'fax']
},
'axis': {'y_labels': ['web', 'mail', 'email', 'fax']},
'unit': 'seconds',
'measure': 'duration',
}
@ -227,24 +204,15 @@ def bijoe_mock(url, request):
if url.path == '/visualization/9/json/':
response = {
'format': '1',
'data': [
[1, 1, 1, 1],
[1],
[1, 1],
],
'axis': {
'y_labels': ['web', 'mail', 'email'],
'loop': ['a', 'b', 'c', 'd'],
}
'data': [[1, 1, 1, 1], [1], [1, 1],],
'axis': {'y_labels': ['web', 'mail', 'email'], 'loop': ['a', 'b', 'c', 'd'],},
}
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
if url.path == '/visualization/10/json/':
response = {
'format': '1',
'data': [10, 20, 30, 40, 0],
'axis': {
'y_labels': ['web', 'mail', 'email', 'fax', 'phone']
},
'axis': {'y_labels': ['web', 'mail', 'email', 'fax', 'phone']},
'unit': None,
'measure': 'percent',
}
@ -256,7 +224,6 @@ def bijoe_mock(url, request):
return {'content': json.dumps(response), 'request': request, 'status_code': 404}
@with_httmock(bijoe_mock)
def test_chartng_cell(app):
page = Page(title='One', slug='index')
@ -288,7 +255,7 @@ def test_chartng_cell(app):
assert chart.raw_series == [
([222], {'title': u'web'}),
([134], {'title': u'mail'}),
([53], {'title': u'email'})
([53], {'title': u'email'}),
]
# data in Y
@ -400,7 +367,7 @@ def test_chartng_cell_hide_null_values(app):
assert chart.raw_series == [
([222], {'title': u'web'}),
([134], {'title': u'mail'}),
([53], {'title': u'email'})
([53], {'title': u'email'}),
]
# data in Y
@ -489,7 +456,7 @@ def test_chartng_cell_sort_order_alpha(app):
assert chart.raw_series == [
([53], {'title': u'email'}),
([134], {'title': u'mail'}),
([222], {'title': u'web'})
([222], {'title': u'web'}),
]
# data in Y
@ -578,7 +545,7 @@ def test_chartng_cell_sort_order_desc(app):
assert chart.raw_series == [
([222], {'title': u'web'}),
([134], {'title': u'mail'}),
([53], {'title': u'email'})
([53], {'title': u'email'}),
]
# data in Y