Skip to content

Commit 445e279

Browse files
committed
test case-insensitive completion
1 parent 088e741 commit 445e279

File tree

1 file changed

+37
-32
lines changed

1 file changed

+37
-32
lines changed

Lib/test/test_sqlite3/test_cli.py

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -264,24 +264,24 @@ def test_complete_sql_keywords(self):
264264

265265
def test_complete_table_indexes_triggers_views(self):
266266
input_ = textwrap.dedent("""\
267-
CREATE TABLE _table (id);
268-
CREATE INDEX _index ON _table (id);
269-
CREATE TRIGGER _trigger BEFORE INSERT
270-
ON _table BEGIN SELECT 1; END;
271-
CREATE VIEW _view AS SELECT 1;
272-
273-
CREATE TEMP TABLE _temp_table (id);
274-
CREATE INDEX temp._temp_index ON _temp_table (id);
275-
CREATE TEMP TRIGGER _temp_trigger BEFORE INSERT
276-
ON _table BEGIN SELECT 1; END;
277-
CREATE TEMP VIEW _temp_view AS SELECT 1;
267+
CREATE TABLE _Table (id);
268+
CREATE INDEX _Index ON _table (id);
269+
CREATE TRIGGER _Trigger BEFORE INSERT
270+
ON _Table BEGIN SELECT 1; END;
271+
CREATE VIEW _View AS SELECT 1;
272+
273+
CREATE TEMP TABLE _Temp_table (id);
274+
CREATE INDEX temp._Temp_index ON _Temp_table (id);
275+
CREATE TEMP TRIGGER _Temp_trigger BEFORE INSERT
276+
ON _Table BEGIN SELECT 1; END;
277+
CREATE TEMP VIEW _Temp_view AS SELECT 1;
278278
279279
ATTACH ':memory:' AS attached;
280-
CREATE TABLE attached._attached_table (id);
281-
CREATE INDEX attached._attached_index ON _attached_table (id);
282-
CREATE TRIGGER attached._attached_trigger BEFORE INSERT
283-
ON _attached_table BEGIN SELECT 1; END;
284-
CREATE VIEW attached._attached_view AS SELECT 1;
280+
CREATE TABLE attached._Attached_table (id);
281+
CREATE INDEX attached._Attached_index ON _Attached_table (id);
282+
CREATE TRIGGER attached._Attached_trigger BEFORE INSERT
283+
ON _Attached_table BEGIN SELECT 1; END;
284+
CREATE VIEW attached._Attached_view AS SELECT 1;
285285
286286
SELECT id FROM _\t\tta\t;
287287
.quit\n""").encode()
@@ -293,18 +293,18 @@ def test_complete_table_indexes_triggers_views(self):
293293
candidates = [l.strip() for l in lines[start+1:end]]
294294
self.assertEqual(candidates,
295295
[
296-
"_attached_index",
297-
"_attached_table",
298-
"_attached_trigger",
299-
"_attached_view",
300-
"_index",
301-
"_table",
302-
"_temp_index",
303-
"_temp_table",
304-
"_temp_trigger",
305-
"_temp_view",
306-
"_trigger",
307-
"_view",
296+
"_Attached_index",
297+
"_Attached_table",
298+
"_Attached_trigger",
299+
"_Attached_view",
300+
"_Index",
301+
"_Table",
302+
"_Temp_index",
303+
"_Temp_table",
304+
"_Temp_trigger",
305+
"_Temp_view",
306+
"_Trigger",
307+
"_View",
308308
],
309309
)
310310

@@ -343,19 +343,24 @@ def test_complete_functions(self):
343343

344344
def test_complete_schemata(self):
345345
input_ = textwrap.dedent("""\
346-
ATTACH ':memory:' AS _attached;
346+
ATTACH ':memory:' AS MixedCase;
347+
-- Test '_' is escaped in Like pattern filtering
348+
ATTACH ':memory:' AS _underscore;
349+
-- Let database_list pragma have a 'temp' schema entry
347350
CREATE TEMP TABLE _table (id);
348351
349-
SELECT * FROM \t\t_att\t.sqlite_master;
352+
SELECT * FROM \t\tmIX\t.sqlite_master;
353+
SELECT * FROM _und\t.sqlite_master;
350354
.quit\n""").encode()
351355
output = self.write_input(input_)
352356
lines = output.decode().splitlines()
353357
indices = [
354358
i for i, line in enumerate(lines) if line.startswith(self.PS1)
355359
]
356-
start, end = indices[-3], indices[-2]
360+
start, end = indices[-4], indices[-3]
357361
candidates = [l.strip() for l in lines[start+1:end]]
358-
self.assertIn("_attached", candidates)
362+
self.assertIn("MixedCase", candidates)
363+
self.assertIn("_underscore", candidates)
359364
self.assertIn("main", candidates)
360365
self.assertIn("temp", candidates)
361366

0 commit comments

Comments
 (0)