diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-01-21 10:28:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-21 10:28:48 (GMT) |
commit | f3d3a3cc114ed30829544c3613b73e4fa6dd5599 (patch) | |
tree | e49779d5a753eeedf702de82e8eb20f3db4bbd70 /Lib/idlelib/idle_test/test_pyparse.py | |
parent | d7b0118a124f11f702bbe6e9f1bad680fb53590b (diff) | |
download | cpython-f3d3a3cc114ed30829544c3613b73e4fa6dd5599.zip cpython-f3d3a3cc114ed30829544c3613b73e4fa6dd5599.tar.gz cpython-f3d3a3cc114ed30829544c3613b73e4fa6dd5599.tar.bz2 |
bpo-32989: IDLE - fix bad editor call of pyparse method (GH-5968)
Fix comments and add tests for editor newline_and_indent_event method.
Remove unused None default for function parameter of pyparse find_good_parse_start method
and code triggered by that default.
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit ec64640a2c5236d7a5d5470d759172a3d93eab0b)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
Diffstat (limited to 'Lib/idlelib/idle_test/test_pyparse.py')
-rw-r--r-- | Lib/idlelib/idle_test/test_pyparse.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Lib/idlelib/idle_test/test_pyparse.py b/Lib/idlelib/idle_test/test_pyparse.py index f7154e6..a2b13c3 100644 --- a/Lib/idlelib/idle_test/test_pyparse.py +++ b/Lib/idlelib/idle_test/test_pyparse.py @@ -18,7 +18,7 @@ class ParseMapTest(unittest.TestCase): # trans is the production instance of ParseMap, used in _study1 parser = pyparse.Parser(4, 4) self.assertEqual('\t a([{b}])b"c\'d\n'.translate(pyparse.trans), - 'xxx(((x)))x"x\'x\n') + 'xxx(((x)))x"x\'x\n') class PyParseTest(unittest.TestCase): @@ -61,14 +61,17 @@ class PyParseTest(unittest.TestCase): # Split def across lines. setcode('"""This is a module docstring"""\n' - 'class C():\n' - ' def __init__(self, a,\n' - ' b=True):\n' - ' pass\n' - ) + 'class C():\n' + ' def __init__(self, a,\n' + ' b=True):\n' + ' pass\n' + ) - # No value sent for is_char_in_string(). - self.assertIsNone(start()) + # Passing no value or non-callable should fail (issue 32989). + with self.assertRaises(TypeError): + start() + with self.assertRaises(TypeError): + start(False) # Make text look like a string. This returns pos as the start # position, but it's set to None. @@ -91,10 +94,10 @@ class PyParseTest(unittest.TestCase): # Code without extra line break in def line - mostly returns the same # values. setcode('"""This is a module docstring"""\n' - 'class C():\n' - ' def __init__(self, a, b=True):\n' - ' pass\n' - ) + 'class C():\n' + ' def __init__(self, a, b=True):\n' + ' pass\n' + ) eq(start(is_char_in_string=lambda index: False), 44) eq(start(is_char_in_string=lambda index: index > 44), 44) eq(start(is_char_in_string=lambda index: index >= 44), 33) |