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

Method test_database_source_name

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

Source from the content-addressed store, hash-verified

142 self.assertEqual(str(err.exception), 'nearly out of space')
143
144 def test_database_source_name(self):
145 with memory_database() as bck:
146 self.cx.backup(bck, name='main')
147 with memory_database() as bck:
148 self.cx.backup(bck, name='temp')
149 with self.assertRaises(sqlite.OperationalError) as cm:
150 with memory_database() as bck:
151 self.cx.backup(bck, name='non-existing')
152 self.assertIn("unknown database", str(cm.exception))
153
154 self.cx.execute("ATTACH DATABASE ':memory:' AS attached_db")
155 self.cx.execute('CREATE TABLE attached_db.foo (key INTEGER)')
156 self.cx.executemany('INSERT INTO attached_db.foo (key) VALUES (?)', [(3,), (4,)])
157 self.cx.commit()
158 with memory_database() as bck:
159 self.cx.backup(bck, name='attached_db')
160 self.verify_backup(bck)
161
162
163if __name__ == "__main__":

Callers

nothing calls this directly

Calls 7

verify_backupMethod · 0.95
memory_databaseFunction · 0.85
strFunction · 0.85
backupMethod · 0.80
assertInMethod · 0.80
assertRaisesMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected