|
28 | 28 | import threading |
29 | 29 | import unittest |
30 | 30 | import urllib.parse |
| 31 | +import warnings |
31 | 32 |
|
32 | 33 | from test.support import ( |
33 | 34 | SHORT_TIMEOUT, check_disallow_instantiation, requires_subprocess, |
@@ -887,6 +888,19 @@ def test_execute_named_param_and_sequence(self): |
887 | 888 | self.cu.execute(query, params) |
888 | 889 | self.assertEqual(cm.filename, __file__) |
889 | 890 |
|
| 891 | + def test_execute_indexed_nameless_params(self): |
| 892 | + # See gh-117995: "'?1' is considered a named placeholder" |
| 893 | + for query, params, expected in ( |
| 894 | + ("select ?1, ?2", (1, 2), (1, 2)), |
| 895 | + ("select ?2, ?1", (1, 2), (2, 1)), |
| 896 | + ): |
| 897 | + with self.subTest(query=query, params=params): |
| 898 | + with warnings.catch_warnings(): |
| 899 | + warnings.simplefilter("error", DeprecationWarning) |
| 900 | + cu = self.cu.execute(query, params) |
| 901 | + actual, = cu.fetchall() |
| 902 | + self.assertEqual(actual, expected) |
| 903 | + |
890 | 904 | def test_execute_too_many_params(self): |
891 | 905 | category = sqlite.SQLITE_LIMIT_VARIABLE_NUMBER |
892 | 906 | msg = "too many SQL variables" |
|
0 commit comments