summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel M. Capella <polyzen@archlinux.org>2020-02-29 16:10:50 -0500
committerDaniel M. Capella <polyzen@archlinux.org>2020-02-29 16:20:31 -0500
commit5754ef46981d688dd249f96fc55ceaf4cd51f130 (patch)
treee27ed985fca1c31ac1b22ab2af99d3ede49dc8bd
parent6dac1884e37ef03b8aac344aa94bbbda6cd1b4c6 (diff)
Fix test_datetimes for PyYAML >=5.3
https://github.com/yaml/pyyaml/pull/163
-rwxr-xr-xtest/test.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/test.py b/test/test.py
index 12fa806..8897196 100755
--- a/test/test.py
+++ b/test/test.py
@@ -3,7 +3,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals
-import os, sys, unittest, tempfile, json, io, platform, subprocess
+import os, sys, unittest, tempfile, json, io, platform, subprocess, yaml
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from yq import yq, cli # noqa
@@ -116,7 +116,10 @@ class TestYq(unittest.TestCase):
def test_datetimes(self):
self.assertEqual(self.run_yq("- 2016-12-20T22:07:36Z\n", ["."]), "")
- self.assertEqual(self.run_yq("- 2016-12-20T22:07:36Z\n", ["-y", "."]), "- '2016-12-20T22:07:36'\n")
+ if yaml.__version__ < '5.3':
+ self.assertEqual(self.run_yq("- 2016-12-20T22:07:36Z\n", ["-y", "."]), "- '2016-12-20T22:07:36'\n")
+ else:
+ self.assertEqual(self.run_yq("- 2016-12-20T22:07:36Z\n", ["-y", "."]), "- '2016-12-20T22:07:36+00:00'\n")
self.assertEqual(self.run_yq("2016-12-20", ["."]), "")
self.assertEqual(self.run_yq("2016-12-20", ["-y", "."]), "'2016-12-20'\n")