summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sqlite3/test_dump.py
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2023-08-27 22:18:32 (GMT)
committerGitHub <noreply@github.com>2023-08-27 22:18:32 (GMT)
commitd0160c7c22c8dff0a61c49b5304244df6e36465e (patch)
tree6604b133b8365249d7a768d133b86ee6c8bdf411 /Lib/test/test_sqlite3/test_dump.py
parentfecb9faf0b2df6a219696502a34b918c5d2bfe9d (diff)
downloadcpython-d0160c7c22c8dff0a61c49b5304244df6e36465e.zip
cpython-d0160c7c22c8dff0a61c49b5304244df6e36465e.tar.gz
cpython-d0160c7c22c8dff0a61c49b5304244df6e36465e.tar.bz2
gh-64662: Add virtual table support to sqlite3.Connection.iterdump (#108340)
Co-authored-by: Aviv Palivoda <palaviv@gmail.com>
Diffstat (limited to 'Lib/test/test_sqlite3/test_dump.py')
-rw-r--r--Lib/test/test_sqlite3/test_dump.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_sqlite3/test_dump.py b/Lib/test/test_sqlite3/test_dump.py
index 5f6811f..3107e1b 100644
--- a/Lib/test/test_sqlite3/test_dump.py
+++ b/Lib/test/test_sqlite3/test_dump.py
@@ -113,6 +113,26 @@ class DumpTests(MemoryDatabaseMixin, unittest.TestCase):
got = list(self.cx.iterdump())
self.assertEqual(expected, got)
+ def test_dump_virtual_tables(self):
+ # gh-64662
+ expected = [
+ "BEGIN TRANSACTION;",
+ "PRAGMA writable_schema=ON;",
+ ("INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"
+ "VALUES('table','test','test',0,'CREATE VIRTUAL TABLE test USING fts4(example)');"),
+ "CREATE TABLE 'test_content'(docid INTEGER PRIMARY KEY, 'c0example');",
+ "CREATE TABLE 'test_docsize'(docid INTEGER PRIMARY KEY, size BLOB);",
+ ("CREATE TABLE 'test_segdir'(level INTEGER,idx INTEGER,start_block INTEGER,"
+ "leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, idx));"),
+ "CREATE TABLE 'test_segments'(blockid INTEGER PRIMARY KEY, block BLOB);",
+ "CREATE TABLE 'test_stat'(id INTEGER PRIMARY KEY, value BLOB);",
+ "PRAGMA writable_schema=OFF;",
+ "COMMIT;"
+ ]
+ self.cu.execute("CREATE VIRTUAL TABLE test USING fts4(example)")
+ actual = list(self.cx.iterdump())
+ self.assertEqual(expected, actual)
+
if __name__ == "__main__":
unittest.main()