mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Fix sith.py line number generation
This commit is contained in:
8
sith.py
8
sith.py
@@ -111,7 +111,13 @@ class TestCase(object):
|
|||||||
if not lines:
|
if not lines:
|
||||||
lines = ['']
|
lines = ['']
|
||||||
line = random.randint(1, len(lines))
|
line = random.randint(1, len(lines))
|
||||||
column = random.randint(0, len(lines[line - 1]))
|
line_string = lines[line - 1]
|
||||||
|
line_len = len(line_string)
|
||||||
|
if line_string.endswith('\r\n'):
|
||||||
|
line_len -= 1
|
||||||
|
if line_string.endswith('\n'):
|
||||||
|
line_len -= 1
|
||||||
|
column = random.randint(0, line_len)
|
||||||
return cls(operation, path, line, column)
|
return cls(operation, path, line, column)
|
||||||
|
|
||||||
def run(self, debugger, record=None, print_result=False):
|
def run(self, debugger, record=None, print_result=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user