Coverage for mindsdb / integrations / handlers / duckdb_handler / tests / test_duckdb_handler.py: 0%

32 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-21 00:36 +0000

1import unittest 

2from mindsdb.api.executor.data_types.response_type import ( 

3 RESPONSE_TYPE, 

4) 

5from mindsdb.integrations.handlers.duckdb_handler.duckdb_handler import ( 

6 DuckDBHandler, 

7) 

8 

9 

10class DuckDBHandlerTest(unittest.TestCase): 

11 @classmethod 

12 def setUpClass(cls): 

13 cls.kwargs = {'connection_data': {'database': 'db.duckdb'}} 

14 cls.handler = DuckDBHandler('test_duckdb_handler', **cls.kwargs) 

15 

16 def test_0_connect(self): 

17 self.handler.connect() 

18 

19 def test_1_check_connection(self): 

20 self.handler.check_connection() 

21 

22 def test_2_drop_table(self): 

23 res = self.handler.query('DROP TABLE IF EXISTS integers;') 

24 assert res.type is not RESPONSE_TYPE.ERROR 

25 

26 def test_3_create_table(self): 

27 res = self.handler.query('CREATE TABLE integers(i INTEGER)') 

28 assert res.type is not RESPONSE_TYPE.ERROR 

29 

30 def test_4_insert_into_table(self): 

31 res = self.handler.query('INSERT INTO integers VALUES (42)') 

32 assert res.type is not RESPONSE_TYPE.ERROR 

33 

34 def test_5_select(self): 

35 res = self.handler.query('SELECT * FROM integers;') 

36 assert res.type is RESPONSE_TYPE.TABLE 

37 

38 def test_6_describe_table(self): 

39 res = self.handler.get_columns('integers') 

40 assert res.type is RESPONSE_TYPE.TABLE 

41 

42 def test_7_get_tables(self): 

43 res = self.handler.get_tables() 

44 assert res.type is not RESPONSE_TYPE.ERROR 

45 

46 

47if __name__ == '__main__': 

48 unittest.main()