mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
forms: make csv import parse dates accepts a list of columns (#4639)
Instead of a boolean which has way less chances to work. While at it add a proper label for the "con" field. Fixes #4637
This commit is contained in:
committed by
Grace Guo
parent
f11cde9eb8
commit
76394d3f8f
28
tests/form_tests.py
Normal file
28
tests/form_tests.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from tests.base_tests import SupersetTestCase
|
||||
from wtforms.form import Form
|
||||
|
||||
from superset.forms import (
|
||||
CommaSeparatedListField, filter_not_empty_values)
|
||||
|
||||
|
||||
class FormTestCase(SupersetTestCase):
|
||||
|
||||
def test_comma_separated_list_field(self):
|
||||
field = CommaSeparatedListField().bind(Form(), 'foo')
|
||||
field.process_formdata([u''])
|
||||
self.assertEqual(field.data, [u''])
|
||||
|
||||
field.process_formdata(['a,comma,separated,list'])
|
||||
self.assertEqual(field.data, [u'a', u'comma', u'separated', u'list'])
|
||||
|
||||
def test_filter_not_empty_values(self):
|
||||
self.assertEqual(filter_not_empty_values(None), None)
|
||||
self.assertEqual(filter_not_empty_values([]), None)
|
||||
self.assertEqual(filter_not_empty_values(['']), None)
|
||||
self.assertEqual(filter_not_empty_values(['hi']), ['hi'])
|
||||
Reference in New Issue
Block a user