19
19
if hasattr (readline , "_READLINE_LIBRARY_VERSION" ):
20
20
is_editline = ("EditLine wrapper" in readline ._READLINE_LIBRARY_VERSION )
21
21
else :
22
- is_editline = ( readline .__doc__ and "libedit" in readline . __doc__ )
22
+ is_editline = readline .backend == "editline"
23
23
24
24
25
25
def setUpModule ():
@@ -145,6 +145,9 @@ def test_init(self):
145
145
TERM = 'xterm-256color' )
146
146
self .assertEqual (stdout , b'' )
147
147
148
+ def test_backend (self ):
149
+ self .assertIn (readline .backend , ("readline" , "editline" ))
150
+
148
151
auto_history_script = """\
149
152
import readline
150
153
readline.set_auto_history({})
@@ -171,7 +174,7 @@ def complete(text, state):
171
174
if state == 0 and text == "$":
172
175
return "$complete"
173
176
return None
174
- if "libedit" in getattr( readline, "__doc__", "") :
177
+ if readline.backend == "editline" :
175
178
readline.parse_and_bind(r'bind "\\ t" rl_complete')
176
179
else:
177
180
readline.parse_and_bind(r'"\\ t": complete')
@@ -198,7 +201,7 @@ def test_nonascii(self):
198
201
199
202
script = r"""import readline
200
203
201
- is_editline = readline.__doc__ and "libedit" in readline.__doc__
204
+ is_editline = readline.backend == "editline"
202
205
inserted = "[\xEFnserted]"
203
206
macro = "|t\xEB[after]"
204
207
set_pre_input_hook = getattr(readline, "set_pre_input_hook", None)
0 commit comments