MCPcopy Index your code
hub / github.com/python/cpython / test_set_lo

Method test_set_lo

Lib/idlelib/idle_test/test_pyparse.py:121–143  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

119 eq(start(is_char_in_string=lambda index: index < pos), pos)
120
121 def test_set_lo(self):
122 code = (
123 '"""This is a module docstring"""\n'
124 'class C:\n'
125 ' def __init__(self, a,\n'
126 ' b=True):\n'
127 ' pass\n'
128 )
129 pos = 42
130 p = self.parser
131 p.set_code(code)
132
133 # Previous character is not a newline.
134 with self.assertRaises(AssertionError):
135 p.set_lo(5)
136
137 # A value of 0 doesn't change self.code.
138 p.set_lo(0)
139 self.assertEqual(p.code, code)
140
141 # An index that is preceded by a newline.
142 p.set_lo(pos)
143 self.assertEqual(p.code, code[pos:])
144
145 def test_study1(self):
146 eq = self.assertEqual

Callers

nothing calls this directly

Calls 4

set_codeMethod · 0.80
set_loMethod · 0.80
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected