diff options
Diffstat (limited to 'testfixtures/tests/test_shouldwarn.py')
-rw-r--r-- | testfixtures/tests/test_shouldwarn.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/testfixtures/tests/test_shouldwarn.py b/testfixtures/tests/test_shouldwarn.py index 1e9b49c..230da76 100644 --- a/testfixtures/tests/test_shouldwarn.py +++ b/testfixtures/tests/test_shouldwarn.py @@ -6,13 +6,18 @@ from testfixtures import ( ShouldWarn, compare, ShouldRaise, ShouldNotWarn, Comparison as C ) -from testfixtures.compat import PY3 +from testfixtures.compat import PY3, PY_37_PLUS if PY3: warn_module = 'builtins' else: warn_module = 'exceptions' +if PY_37_PLUS: + comma = '' +else: + comma = ',' + from .compat import py_36_plus @@ -29,7 +34,7 @@ class ShouldWarnTests(TestCase): "sequence not as expected:\n\n" "same:\n[]\n\n" "expected:\n[]\n\n" - "actual:\n[UserWarning('foo',)]" + "actual:\n[UserWarning('foo'"+comma+")]" )): with warnings.catch_warnings(record=True) as backstop: with ShouldNotWarn(): @@ -76,7 +81,7 @@ class ShouldWarnTests(TestCase): "same:\n[]\n\n" "expected:\n" "[<C(failed):"+warn_module+".DeprecationWarning>wrong type</C>]\n\n" - "actual:\n[UserWarning('foo',)]" + "actual:\n[UserWarning('foo'"+comma+")]" )): with ShouldWarn(DeprecationWarning): warnings.warn('foo') @@ -95,7 +100,7 @@ class ShouldWarnTests(TestCase): " <C(failed):"+warn_module+".DeprecationWarning>\n" " args:('bar',) != ('foo',)" "\n </C>]\n\n" - "actual:\n[DeprecationWarning('foo',)]" + "actual:\n[DeprecationWarning('foo'"+comma+")]" )): with ShouldWarn(DeprecationWarning('bar')): warnings.warn_explicit( |