Skip to content

Commit 608543c

Browse files
committed
Remove the conditional
1 parent b657a1f commit 608543c

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

Lib/sqlite3/__main__.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,12 @@ def main(*args):
132132
theme = get_theme()
133133
s = theme.syntax
134134

135-
if s.prompt:
136-
# Use RL_PROMPT_START_IGNORE (\001) and RL_PROMPT_END_IGNORE (\002) to
137-
# bracket non-printing characters. This tells readline to ignore them
138-
# when calculating screen space for redisplay during history scrolling.
139-
# See https://stackoverflow.com/a/9468954 for more details.
140-
sys.ps1 = f"\001{s.prompt}\002sqlite> \001{s.reset}\002"
141-
sys.ps2 = f"\001{s.prompt}\002 ... \001{s.reset}\002"
142-
else:
143-
sys.ps1 = "sqlite> "
144-
sys.ps2 = " ... "
135+
# Use RL_PROMPT_START_IGNORE (\001) and RL_PROMPT_END_IGNORE (\002) to
136+
# bracket non-printing characters. This tells readline to ignore them
137+
# when calculating screen space for redisplay during history scrolling.
138+
# See https://stackoverflow.com/a/9468954 for more details.
139+
sys.ps1 = f"\001{s.prompt}\002sqlite> \001{s.reset}\002"
140+
sys.ps2 = f"\001{s.prompt}\002 ... \001{s.reset}\002"
145141

146142
con = sqlite3.connect(args.filename, isolation_level=None)
147143
try:

Lib/test/test_sqlite3/test_cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def test_cli_on_disk_db(self):
8080
@force_not_colorized_test_class
8181
class InteractiveSession(unittest.TestCase):
8282
MEMORY_DB_MSG = "Connected to a transient in-memory database"
83-
PS1 = "sqlite> "
84-
PS2 = "... "
83+
PS1 = "\001\002sqlite> \001\002"
84+
PS2 = "\001\002 ... \001\002"
8585

8686
def run_cli(self, *args, commands=()):
8787
with (
@@ -212,7 +212,7 @@ def test_color(self):
212212
@requires_subprocess()
213213
@force_not_colorized_test_class
214214
class Completion(unittest.TestCase):
215-
PS1 = "sqlite> "
215+
PS1_NO_COLOR = "sqlite> "
216216

217217
@classmethod
218218
def setUpClass(cls):
@@ -260,7 +260,7 @@ def test_complete_no_match(self):
260260
lines = output.decode().splitlines()
261261
indices = (
262262
i for i, line in enumerate(lines, 1)
263-
if line.startswith(f"{self.PS1}xyzzy")
263+
if line.startswith(f"{self.PS1_NO_COLOR}xyzzy")
264264
)
265265
line_num = next(indices, -1)
266266
self.assertNotEqual(line_num, -1)
@@ -296,7 +296,7 @@ def test_complete_no_input(self):
296296
lines = output.decode().splitlines()
297297
indices = [
298298
i for i, line in enumerate(lines)
299-
if line.startswith(self.PS1)
299+
if line.startswith(self.PS1_NO_COLOR)
300300
]
301301
self.assertEqual(len(indices), 2)
302302
start, end = indices

0 commit comments

Comments
 (0)