@@ 1675-1694 (lines=20) @@ | ||
1672 | """Extended iterable unpacking is added with Python 3.""" |
|
1673 | version = (3, 0) |
|
1674 | code = '(a, *rest, b) = range(5)' |
|
1675 | self.throws(code, INVALIDSYNTAX, [], up_to_version(version)) |
|
1676 | self.runs(code, from_version(version)) |
|
1677 | ||
1678 | def test_ellipsis(self): |
|
1679 | """Triple dot (...) aka Ellipsis can be used anywhere in Python 3.""" |
|
1680 | version = (3, 0) |
|
1681 | code = '...' |
|
1682 | self.throws(code, INVALIDSYNTAX, [], up_to_version(version)) |
|
1683 | self.runs(code, from_version(version)) |
|
1684 | ||
1685 | ||
1686 | class MemoryErrorTests(GetSuggestionsTests): |
|
1687 | """Class for tests related to MemoryError.""" |
|
1688 | ||
1689 | def test_out_of_memory(self): |
|
1690 | """Test what happens in case of MemoryError.""" |
|
1691 | code = '[0] * 999999999999999' |
|
1692 | self.throws(code, MEMORYERROR) |
|
1693 | ||
1694 | def test_out_of_memory_range(self): |
|
1695 | """Test what happens in case of MemoryError.""" |
|
1696 | code = '{0}(999999999999999)' |
|
1697 | typo, sugg = 'range', 'xrange' |
|
@@ 920-939 (lines=20) @@ | ||
917 | UNKNOWN_ATTRIBUTEERROR) |
|
918 | ||
919 | # TODO: Add sugg for situation where self/cls is the missing parameter |
|
920 | ||
921 | ||
922 | class TypeErrorTests(GetSuggestionsTests): |
|
923 | """Class for tests related to TypeError.""" |
|
924 | ||
925 | def test_unhashable(self): |
|
926 | """Test that other errors do not crash.""" |
|
927 | self.throws('dict()[list()] = 1', UNHASHABLE) |
|
928 | ||
929 | def test_not_sub(self): |
|
930 | """Should be function call, not [] operator.""" |
|
931 | typo, sugg = '[2]', '(2)' |
|
932 | code = func_gen(param='a') + 'some_func{0}' |
|
933 | bad_code, good_code = format_str(code, typo, sugg) |
|
934 | suggestion = "'function(value)'" |
|
935 | # Only Python 2.7 with cpython has a different error message |
|
936 | # (leading to more suggestions based on fuzzy matches) |
|
937 | version1 = (2, 7) |
|
938 | version2 = (3, 0) |
|
939 | self.throws(bad_code, UNSUBSCRIPTABLE, suggestion, |
|
940 | ALL_VERSIONS, 'pypy') |
|
941 | self.throws(bad_code, UNSUBSCRIPTABLE, suggestion, |
|
942 | up_to_version(version1), 'cython') |