mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore: add more csv tests (#32663)
This commit is contained in:
committed by
GitHub
parent
1947d4da76
commit
2465ab4a98
@@ -2060,6 +2060,97 @@ COUNT(is_software_dev)
|
||||
}
|
||||
|
||||
|
||||
def test_apply_client_processing_csv_format_simple_table():
|
||||
"""
|
||||
It should be able to process csv results
|
||||
And not show a default column
|
||||
"""
|
||||
|
||||
result = {
|
||||
"queries": [
|
||||
{
|
||||
"result_format": ChartDataResultFormat.CSV,
|
||||
"data": """
|
||||
COUNT(is_software_dev)
|
||||
4725
|
||||
""",
|
||||
}
|
||||
]
|
||||
}
|
||||
form_data = {
|
||||
"datasource": "19__table",
|
||||
"viz_type": "table",
|
||||
"slice_id": 69,
|
||||
"url_params": {},
|
||||
"granularity_sqla": "time_start",
|
||||
"time_grain_sqla": "P1D",
|
||||
"time_range": "No filter",
|
||||
"groupbyColumns": [],
|
||||
"groupbyRows": [],
|
||||
"metrics": [
|
||||
{
|
||||
"aggregate": "COUNT",
|
||||
"column": {
|
||||
"column_name": "is_software_dev",
|
||||
"description": None,
|
||||
"expression": None,
|
||||
"filterable": True,
|
||||
"groupby": True,
|
||||
"id": 1463,
|
||||
"is_dttm": False,
|
||||
"python_date_format": None,
|
||||
"type": "DOUBLE PRECISION",
|
||||
"verbose_name": None,
|
||||
},
|
||||
"expressionType": "SIMPLE",
|
||||
"hasCustomLabel": False,
|
||||
"isNew": False,
|
||||
"label": "COUNT(is_software_dev)",
|
||||
"optionName": "metric_9i1kctig9yr_sizo6ihd2o",
|
||||
"sqlExpression": None,
|
||||
}
|
||||
],
|
||||
"metricsLayout": "COLUMNS",
|
||||
"adhoc_filters": [
|
||||
{
|
||||
"clause": "WHERE",
|
||||
"comparator": "Currently A Developer",
|
||||
"expressionType": "SIMPLE",
|
||||
"filterOptionName": "filter_fvi0jg9aii_2lekqrhy7qk",
|
||||
"isExtra": False,
|
||||
"isNew": False,
|
||||
"operator": "==",
|
||||
"sqlExpression": None,
|
||||
"subject": "developer_type",
|
||||
}
|
||||
],
|
||||
"row_limit": 10000,
|
||||
"order_desc": True,
|
||||
"aggregateFunction": "Sum",
|
||||
"valueFormat": "SMART_NUMBER",
|
||||
"date_format": "smart_date",
|
||||
"rowOrder": "key_a_to_z",
|
||||
"colOrder": "key_a_to_z",
|
||||
"extra_form_data": {},
|
||||
"force": False,
|
||||
"result_format": "json",
|
||||
"result_type": "results",
|
||||
}
|
||||
|
||||
assert apply_client_processing(result, form_data) == {
|
||||
"queries": [
|
||||
{
|
||||
"result_format": ChartDataResultFormat.CSV,
|
||||
"data": "COUNT(is_software_dev)\n4725\n",
|
||||
"colnames": ["COUNT(is_software_dev)"],
|
||||
"indexnames": [0],
|
||||
"coltypes": [GenericDataType.NUMERIC],
|
||||
"rowcount": 1,
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
def test_apply_client_processing_csv_format_empty_string():
|
||||
"""
|
||||
It should be able to process csv results with no data
|
||||
|
||||
Reference in New Issue
Block a user