summaryrefslogtreecommitdiff
path: root/contrib/python/test
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2018-05-21 16:31:36 -0700
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-23 17:54:09 +0000
commit5f0d4b10e9b5ea18e91090e82ddfb22f63b06635 (patch)
tree0a308dd23c0f1c2149f8d597224ba73440bf793d /contrib/python/test
parentc1efde20e01f255b1186d6958371da4f5401310a (diff)
downloadpodman-5f0d4b10e9b5ea18e91090e82ddfb22f63b06635.tar.gz
podman-5f0d4b10e9b5ea18e91090e82ddfb22f63b06635.tar.bz2
podman-5f0d4b10e9b5ea18e91090e82ddfb22f63b06635.zip
Add support for Zulu timestamp parsing
- Improve error message when podman varlink service is not running Signed-off-by: Jhon Honce <jhonce@redhat.com> Closes: #800 Approved by: rhatdan
Diffstat (limited to 'contrib/python/test')
-rw-r--r--contrib/python/test/test_libs.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/contrib/python/test/test_libs.py b/contrib/python/test/test_libs.py
index e2160fc30..202bed1d8 100644
--- a/contrib/python/test/test_libs.py
+++ b/contrib/python/test/test_libs.py
@@ -18,19 +18,26 @@ class TestLibs(unittest.TestCase):
'2018-05-08T14:12:53.797795191-07:00',
'2018-05-08T14:12:53.797795-07:00',
'2018-05-08T14:12:53.797795-0700',
- '2018-05-08 14:12:53.797795191 -0700 MST'
+ '2018-05-08 14:12:53.797795191 -0700 MST',
]:
actual = podman.datetime_parse(v)
self.assertEqual(actual, expected)
- podman.datetime_parse(datetime.datetime.now().isoformat())
+ expected = datetime.datetime.strptime(
+ '2018-05-08T14:12:53.797795-0000', '%Y-%m-%dT%H:%M:%S.%f%z')
+ for v in [
+ '2018-05-08T14:12:53.797795191Z',
+ '2018-05-08T14:12:53.797795191z',
+ ]:
+ actual = podman.datetime_parse(v)
+ self.assertEqual(actual, expected)
+
+ actual = podman.datetime_parse(datetime.datetime.now().isoformat())
+ self.assertIsNotNone(actual)
def test_parse_fail(self):
- # chronologist humor: '1752-09-05T12:00:00.000000-0000' also not
- # handled correctly by python for my locale.
for v in [
- '1752-9-5',
- '1752-09-05',
+ 'There is no time here.',
]:
with self.assertRaises(ValueError):
podman.datetime_parse(v)