MCPcopy Index your code
hub / github.com/python/cpython / test_modifying_progress

Method test_modifying_progress

Lib/test/test_sqlite3/test_backup.py:112–133  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

110 self.assertEqual(str(cm.exception), 'progress argument must be a callable')
111
112 def test_modifying_progress(self):
113 journal = []
114
115 def progress(status, remaining, total):
116 if not journal:
117 self.cx.execute('INSERT INTO foo (key) VALUES (?)', (remaining+1000,))
118 self.cx.commit()
119 journal.append(remaining)
120
121 with memory_database() as bck:
122 self.cx.backup(bck, pages=1, progress=progress)
123 self.verify_backup(bck)
124
125 result = bck.execute("SELECT key FROM foo"
126 " WHERE key >= 1000"
127 " ORDER BY key").fetchall()
128 self.assertEqual(result[0][0], 1001)
129
130 self.assertEqual(len(journal), 3)
131 self.assertEqual(journal[0], 1)
132 self.assertEqual(journal[1], 1)
133 self.assertEqual(journal[2], 0)
134
135 def test_failing_progress(self):
136 def progress(status, remaining, total):

Callers

nothing calls this directly

Calls 5

verify_backupMethod · 0.95
memory_databaseFunction · 0.85
backupMethod · 0.80
executeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected