Skip to content

Commit 92e9b0b

Browse files
committed
No need to catch this AttributeError in test code
1 parent 7ca380d commit 92e9b0b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

bpython/test/test_interpreter.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import unicode_literals
44

5+
import linecache
56
import sys
67

78
try:
@@ -20,11 +21,7 @@
2021
def _last_console_filename():
2122
"""Returns the last 'filename' used for console input
2223
(as will be displayed in a traceback)."""
23-
import linecache
24-
try:
25-
return '<bpython-input-%s>' % (len(linecache.cache.bpython_history) - 1)
26-
except AttributeError:
27-
return '<input>'
24+
return '<bpython-input-%s>' % (len(linecache.cache.bpython_history) - 1)
2825

2926
class TestInterpreter(unittest.TestCase):
3027
def test_syntaxerror(self):

0 commit comments

Comments
 (0)