diff options
author | Cheryl Sabella <cheryl.sabella@gmail.com> | 2020-01-21 10:11:26 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2020-01-21 10:11:26 (GMT) |
commit | ec64640a2c5236d7a5d5470d759172a3d93eab0b (patch) | |
tree | ad86cfb197213427cf1e00f8aee003980110629d /Lib/idlelib/idle_test/test_pyparse.py | |
parent | 8698b34b68065b80bd9bd18b8decb425208fa386 (diff) | |
download | cpython-ec64640a2c5236d7a5d5470d759172a3d93eab0b.zip cpython-ec64640a2c5236d7a5d5470d759172a3d93eab0b.tar.gz cpython-ec64640a2c5236d7a5d5470d759172a3d93eab0b.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>
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) |