Skip to content

Commit

Permalink
Test connect properties
Browse files Browse the repository at this point in the history
  • Loading branch information
auxten committed Nov 22, 2024
1 parent b5945e1 commit 7c3cdde
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/test_conn_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from chdb import connect

enable_print = False
db_path = "test_db_3fdds"


Expand Down Expand Up @@ -271,6 +270,23 @@ def test_multiple_connections(self):
conn1.close()
conn2.close()

def test_connection_properties(self):
# conn = connect("{db_path}?log_queries=1&verbose=1&log-level=test")
with self.assertRaises(Exception):
conn = connect(f"{db_path}?not_exist_flag=1")
with self.assertRaises(Exception):
conn = connect(f"{db_path}?verbose=1")

conn = connect(f"{db_path}?verbose&log-level=test")
ret = conn.query("SELECT 123", "CSV")
print(ret)
print(len(ret))
self.assertEqual(str(ret), "123\n")
ret = conn.query("show tables in system", "CSV")
self.assertGreater(len(ret), 10)

conn.close()


if __name__ == "__main__":
unittest.main()

0 comments on commit 7c3cdde

Please sign in to comment.