Show More
@@ -113,6 +113,18 b' def test_extract_dates():' | |||
|
113 | 113 | nt.assert_true(isinstance(dt, datetime.datetime)) |
|
114 | 114 | nt.assert_equal(dt, ref) |
|
115 | 115 | |
|
116 | def test_parse_ms_precision(): | |
|
117 | base = '2013-07-03T16:34:52.' | |
|
118 | digits = '1234567890' | |
|
119 | ||
|
120 | for i in range(len(digits)): | |
|
121 | ts = base + digits[:i] | |
|
122 | parsed = jsonutil.parse_date(ts) | |
|
123 | if i >= 1 and i <= 6: | |
|
124 | assert isinstance(parsed, datetime.datetime) | |
|
125 | else: | |
|
126 | assert isinstance(parsed, str) | |
|
127 | ||
|
116 | 128 | def test_date_default(): |
|
117 | 129 | data = dict(today=datetime.datetime.now(), utcnow=tz.utcnow()) |
|
118 | 130 | jsondata = json.dumps(data, default=jsonutil.date_default) |
General Comments 0
You need to be logged in to leave comments.
Login now