Silence some py3k SyntaxWarning using check_py3k_warnings() with "exec" statements.

This commit is contained in:
Florent Xicluna 2010-03-21 11:03:21 +00:00
parent 8f43cec41b
commit af61719ec3
2 changed files with 35 additions and 3 deletions

View file

@ -2,6 +2,7 @@ import unittest
import sys
import _ast
from test import test_support
import textwrap
class TestSpecifics(unittest.TestCase):
@ -142,6 +143,9 @@ def f(x):
def test_complex_args(self):
with test_support.check_py3k_warnings(
("tuple parameter unpacking has been removed", SyntaxWarning)):
exec textwrap.dedent('''
def comp_args((a, b)):
return a,b
self.assertEqual(comp_args((1, 2)), (1, 2))
@ -159,6 +163,7 @@ def f(x):
return a, b, c
self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3))
self.assertEqual(comp_args(), (2, 3, 4))
''')
def test_argument_order(self):
try: