@@ 1356-1372 (lines=17) @@ | ||
1353 | self.runs(cmp_arg, up_to_version(v3)) |
|
1354 | self.throws(cmp_arg, UNEXPECTEDKWARG2, |
|
1355 | CMP_ARG_REMOVED_MSG, from_version(v3), 'cython') |
|
1356 | self.throws(cmp_arg, UNEXPECTEDKWARG, |
|
1357 | CMP_ARG_REMOVED_MSG, from_version(v3), 'pypy') |
|
1358 | self.runs(key_arg) |
|
1359 | self.runs(cmp_to_key, from_version((2, 7))) |
|
1360 | ||
1361 | def test_no_implicit_str_conv(self): |
|
1362 | """Trying to concatenate a non-string value to a string.""" |
|
1363 | # NICE_TO_HAVE |
|
1364 | code = '{0} + " things"' |
|
1365 | typo, sugg = '12', 'str(12)' |
|
1366 | bad_code, good_code = format_str(code, typo, sugg) |
|
1367 | self.throws(bad_code, UNSUPPORTEDOPERAND) |
|
1368 | self.runs(good_code) |
|
1369 | ||
1370 | def test_no_implicit_str_conv2(self): |
|
1371 | """Trying to concatenate a non-string value to a string.""" |
|
1372 | # NICE_TO_HAVE |
|
1373 | code = '"things " + {0}' |
|
1374 | typo, sugg = '12', 'str(12)' |
|
1375 | bad_code, good_code = format_str(code, typo, sugg) |
|
@@ 1808-1818 (lines=11) @@ | ||
1805 | ||
1806 | def test_nonlocal(self): |
|
1807 | """nonlocal keyword is added in Python 3.""" |
|
1808 | # NICE_TO_HAVE |
|
1809 | version = (3, 0) |
|
1810 | code = 'def func():\n\tfoo = 1\n\tdef nested():\n\t\tnonlocal foo' |
|
1811 | self.runs(code, from_version(version)) |
|
1812 | self.throws(code, INVALIDSYNTAX, [], up_to_version(version)) |
|
1813 | ||
1814 | def test_nonlocal2(self): |
|
1815 | """nonlocal must be used only when binding exists.""" |
|
1816 | # NICE_TO_HAVE |
|
1817 | version = (3, 0) |
|
1818 | code = 'def func():\n\tdef nested():\n\t\tnonlocal foo' |
|
1819 | self.throws(code, NOBINDING, [], from_version(version)) |
|
1820 | self.throws(code, INVALIDSYNTAX, [], up_to_version(version)) |
|
1821 |