@@ 1356-1372 (lines=17) @@ | ||
1353 | # It would be NICE_TO_HAVE suggestions on keyword arguments |
|
1354 | v3 = (3, 0) |
|
1355 | code = "c = 'string'\nb = print(c, end_='toto')" |
|
1356 | self.throws(code, INVALIDSYNTAX, [], up_to_version(v3)) |
|
1357 | self.throws(code, UNEXPECTEDKWARG2, [], from_version(v3), 'cython') |
|
1358 | self.throws(code, UNEXPECTEDKWARG3, [], from_version(v3), 'pypy') |
|
1359 | ||
1360 | def test_keyword_sort_cmpkey(self): |
|
1361 | """Sort and sorted functions have a cmp/key param dep. on the vers.""" |
|
1362 | # NICE_TO_HAVE |
|
1363 | v3 = (3, 0) |
|
1364 | code = "import functools as f\nl = [1, 8, 3]\n" \ |
|
1365 | "def comp(a, b): return (a > b) - (a < b)\nl.sort({0})" |
|
1366 | cmp_arg, key_arg, cmp_to_key = format_str( |
|
1367 | code, 'cmp=comp', 'key=id', 'key=f.cmp_to_key(comp)') |
|
1368 | self.runs(cmp_arg, up_to_version(v3)) |
|
1369 | self.throws(cmp_arg, UNEXPECTEDKWARG2, |
|
1370 | CMP_ARG_REMOVED_MSG, from_version(v3), 'cython') |
|
1371 | self.throws(cmp_arg, UNEXPECTEDKWARG, |
|
1372 | CMP_ARG_REMOVED_MSG, from_version(v3), 'pypy') |
|
1373 | self.runs(key_arg) |
|
1374 | self.runs(cmp_to_key, from_version((2, 7))) |
|
1375 | ||
@@ 1808-1818 (lines=11) @@ | ||
1805 | "def func1():\n\tbar='1'\n\tdef func2():" |
|
1806 | "\n\t\tfrom math import *\n\t\tTrue\n\tfunc2()\nfunc1()", |
|
1807 | "def func1():\n\tfrom math import *" |
|
1808 | "\n\tdef func2():\n\t\tTrue", |
|
1809 | ] |
|
1810 | with warnings.catch_warnings(): |
|
1811 | warnings.simplefilter("ignore", category=SyntaxWarning) |
|
1812 | for code in codes: |
|
1813 | self.throws(code, IMPORTSTAR, []) |
|
1814 | ||
1815 | def test_unpack(self): |
|
1816 | """Extended tuple unpacking does not work prior to Python 3.""" |
|
1817 | # NICE_TO_HAVE |
|
1818 | version = (3, 0) |
|
1819 | code = 'a, *b = (1, 2, 3)' |
|
1820 | self.throws(code, INVALIDSYNTAX, [], up_to_version(version)) |
|
1821 | self.runs(code, from_version(version)) |