MCPcopy Create free account
hub / github.com/EntilZha/PyFunctional / test_to_sqlite3_file

Method test_to_sqlite3_file

functional/test/test_streams.py:400–413  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

398 self.seq(elements).to_sqlite3(1, insert_sql)
399
400 def test_to_sqlite3_file(self):
401 tmp_path = "functional/test/data/tmp/test.db"
402
403 with sqlite3.connect(tmp_path) as conn:
404 conn.execute("DROP TABLE IF EXISTS user;")
405 conn.execute("CREATE TABLE user (id INT, name TEXT);")
406 conn.commit()
407
408 insert_sql = "INSERT INTO user (id, name) VALUES (?, ?)"
409 elements = [(1, "Tom"), (2, "Jack"), (3, "Jane"), (4, "Stephan")]
410
411 self.seq(elements).to_sqlite3(tmp_path, insert_sql)
412 result = self.seq.sqlite3(tmp_path, "SELECT id, name FROM user;").to_list()
413 self.assertListEqual(elements, result)
414
415 def test_to_sqlite3_query(self):
416 elements = [(1, "Tom"), (2, "Jack"), (3, "Jane"), (4, "Stephan")]

Callers

nothing calls this directly

Calls 3

to_sqlite3Method · 0.80
to_listMethod · 0.80
sqlite3Method · 0.80

Tested by

no test coverage detected