Browse Source

Test date parsing

zolfa-add_slices_loading
Ruben Verweij 8 years ago
parent
commit
7761dabac2
1 changed files with 18 additions and 1 deletions
  1. +18
    -1
      tests/test_common.py

+ 18
- 1
tests/test_common.py View File

@ -1,6 +1,7 @@
import unittest
from nd2reader.common import parse_version
import six
from nd2reader.common import parse_version, parse_date
class TestCommon(unittest.TestCase):
@ -15,3 +16,19 @@ class TestCommon(unittest.TestCase):
actual = parse_version(data)
expected = (3, 0)
self.assertTupleEqual(actual, expected)
def test_parse_date_24(self):
date_format = "%m/%d/%Y %H:%M:%S"
date = '02/13/2016 23:43:37'
textinfo = {six.b('TextInfoItem9'): six.b(date)}
result = parse_date(textinfo)
self.assertEqual(result.strftime(date_format), date)
def test_parse_date_12(self):
date_format = "%m/%d/%Y %I:%M:%S %p"
date = '02/13/2016 11:43:37 PM'
textinfo = {six.b('TextInfoItem9'): six.b(date)}
result = parse_date(textinfo)
self.assertEqual(result.strftime(date_format), date)

Loading…
Cancel
Save