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

Method test_to_sqlite3_dict

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

Source from the content-addressed store, hash-verified

470 self.assertListEqual(elements, result)
471
472 def test_to_sqlite3_dict(self):
473 elements = [(1, "Tom"), (2, "Jack"), (3, "Jane"), (4, "Stephan")]
474
475 with sqlite3.connect(":memory:") as conn:
476 conn.execute("CREATE TABLE user (id INT, name TEXT);")
477 conn.commit()
478
479 table_name = "user"
480 self.seq(elements).map(lambda x: {"id": x[0], "name": x[1]}).to_sqlite3(
481 conn, table_name
482 )
483 result = self.seq.sqlite3(conn, "SELECT id, name FROM user;").to_list()
484 self.assertListEqual(elements, result)
485
486 def test_to_sqlite3_typerror(self):
487 elements = [1, 2, 3]

Callers

nothing calls this directly

Calls 4

to_sqlite3Method · 0.80
mapMethod · 0.80
to_listMethod · 0.80
sqlite3Method · 0.80

Tested by

no test coverage detected