mirror of
https://github.com/apache/superset.git
synced 2024-09-18 11:39:49 -04:00
15b67b2c6c
* Change in files * Renamin files and folders * cleaning up a single piece of lint * Removing boat picture from docs * add superset word mark * Update rename note in docs * Fixing images * Pinning datatables * Fixing issues with mapbox-gl * Forgot to rename one file * Linting * v0.13.0 * adding pyyaml to dev-reqs
19 lines
704 B
Python
19 lines
704 B
Python
from datetime import datetime, date, timedelta
|
|
from superset import utils
|
|
import unittest
|
|
|
|
|
|
class UtilsTestCase(unittest.TestCase):
|
|
def test_json_int_dttm_ser(self):
|
|
dttm = datetime(2020, 1, 1)
|
|
ts = 1577836800000.0
|
|
json_int_dttm_ser = utils.json_int_dttm_ser
|
|
assert json_int_dttm_ser(dttm) == ts
|
|
assert json_int_dttm_ser(date(2020, 1, 1)) == ts
|
|
assert json_int_dttm_ser(datetime(1970, 1, 1)) == 0
|
|
assert json_int_dttm_ser(date(1970, 1, 1)) == 0
|
|
assert json_int_dttm_ser(dttm + timedelta(milliseconds=1)) == (ts + 1)
|
|
|
|
with self.assertRaises(TypeError):
|
|
utils.json_int_dttm_ser("this is not a date")
|