forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
forms: make csv import parse dates accepts a list of columns (apache#…
…4639) Instead of a boolean which has way less chances to work. While at it add a proper label for the "con" field. Fixes apache#4637
- Loading branch information
1 parent
ec84139
commit d9c2e57
Showing
3 changed files
with
61 additions
and
4 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
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
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,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']) |