Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 776f4d9

Browse files
author
Jonathan Kliem
committed
handle errors correctly
1 parent 1efb0bc commit 776f4d9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/bin/sage-fixdoctests

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,17 @@ for block in doctests:
7676
elif 'Expected:' in block:
7777
exp = block.find('Expected:\n')
7878
block=block[exp+10:]
79+
elif 'Exception raised' in block:
80+
exp = block.find('Exception raised')
81+
block='\nGot:\n'+block[exp+17:]
7982
else:
8083
continue
81-
if block[-21:]=='Got:\n <BLANKLINE>\n':
84+
# Error testing.
85+
if 'Traceback (most recent call last):' in block:
86+
expected, got = block.split('\nGot:\n')
87+
got = got.splitlines()
88+
got = [' Traceback (most recent call last):', ' ...', got[-1]]
89+
elif block[-21:]=='Got:\n <BLANKLINE>\n':
8290
expected=block[:-22]
8391
got=['']
8492
else:

0 commit comments

Comments
 (0)