summaryrefslogtreecommitdiff
path: root/testfixtures/tests/test_compare.py
diff options
context:
space:
mode:
Diffstat (limited to 'testfixtures/tests/test_compare.py')
-rw-r--r--testfixtures/tests/test_compare.py38
1 files changed, 26 insertions, 12 deletions
diff --git a/testfixtures/tests/test_compare.py b/testfixtures/tests/test_compare.py
index 8e390c7..f525a14 100644
--- a/testfixtures/tests/test_compare.py
+++ b/testfixtures/tests/test_compare.py
@@ -15,7 +15,8 @@ from testfixtures import (
)
from testfixtures.compat import (
class_type_name, exception_module, PY3, xrange,
- BytesLiteral, UnicodeLiteral
+ BytesLiteral, UnicodeLiteral,
+ PY_37_PLUS
)
from testfixtures.comparison import compare_sequence
from unittest import TestCase
@@ -152,10 +153,16 @@ class TestCompare(CompareHelper, TestCase):
def test_exception_different_object(self):
e1 = ValueError('some message')
e2 = ValueError('some message')
- self.check_raises(
- e1, e2,
- "ValueError('some message',) != ValueError('some message',)"
- )
+ if PY_37_PLUS:
+ self.check_raises(
+ e1, e2,
+ "ValueError('some message') != ValueError('some message')"
+ )
+ else:
+ self.check_raises(
+ e1, e2,
+ "ValueError('some message',) != ValueError('some message',)"
+ )
def test_exception_different_object_c_wrapper(self):
e1 = ValueError('some message')
@@ -165,10 +172,16 @@ class TestCompare(CompareHelper, TestCase):
def test_exception_diff(self):
e1 = ValueError('some message')
e2 = ValueError('some other message')
- self.check_raises(
- e1, e2,
- "ValueError('some message',) != ValueError('some other message',)"
- )
+ if PY_37_PLUS:
+ self.check_raises(
+ e1, e2,
+ "ValueError('some message') != ValueError('some other message')"
+ )
+ else:
+ self.check_raises(
+ e1, e2,
+ "ValueError('some message',) != ValueError('some other message',)"
+ )
def test_exception_diff_c_wrapper(self):
e1 = ValueError('some message')
@@ -176,12 +189,13 @@ class TestCompare(CompareHelper, TestCase):
self.check_raises(
C(e1), e2,
("\n"
- " <C(failed):{0}.ValueError>\n"
+ " <C(failed):{}.ValueError>\n"
" args:('some message',) != ('some other message',)\n"
" </C>"
" != "
- "ValueError('some other message',)"
- ).format(exception_module))
+ "ValueError('some other message'{})"
+ ).format(exception_module,
+ '' if PY_37_PLUS else ','))
def test_sequence_long(self):
self.check_raises(