summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-08-03 13:31:48 +0000
committerGerrit Code Review <review@openstack.org>2018-08-03 13:31:48 +0000
commitd46afa6ed2b83d301c2883c40efc899ac5e2ca4a (patch)
treeb27cf21a8412f2001e643d8ae36b835c1174c75f
parent2af0c0e0d97e10d280b222aa47e34c985f33aeab (diff)
parent254e0ae839ecc692192f29e3aa590e6d5d3377a7 (diff)
downloadoslo-serialization-d46afa6ed2b83d301c2883c40efc899ac5e2ca4a.tar.gz
Merge "py37: deal with Exception repr changes"
-rw-r--r--oslo_serialization/tests/test_jsonutils.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/oslo_serialization/tests/test_jsonutils.py b/oslo_serialization/tests/test_jsonutils.py
index da8edd4..afa8948 100644
--- a/oslo_serialization/tests/test_jsonutils.py
+++ b/oslo_serialization/tests/test_jsonutils.py
@@ -116,8 +116,9 @@ class JSONUtilsTestMixin(object):
self.assertIsInstance(val, six.text_type)
def test_dumps_exception_value(self):
- self.assertEqual('{"a": "ValueError(\'hello\',)"}',
- jsonutils.dumps({"a": ValueError("hello")}))
+ self.assertIn(jsonutils.dumps({"a": ValueError("hello")}),
+ ['{"a": "ValueError(\'hello\',)"}',
+ '{"a": "ValueError(\'hello\')"}'])
class JSONUtilsTestJson(JSONUtilsTestMixin, test_base.BaseTestCase):
@@ -407,5 +408,6 @@ class ToPrimitiveTestCase(test_base.BaseTestCase):
self.assertEqual('fallback', ret)
def test_exception(self):
- self.assertEqual("ValueError('an exception',)",
- jsonutils.to_primitive(ValueError("an exception")))
+ self.assertIn(jsonutils.to_primitive(ValueError("an exception")),
+ ["ValueError('an exception',)",
+ "ValueError('an exception')"])