Coverage for mindsdb / integrations / handlers / monetdb_handler / tests / test_monetdb_handler.py: 0%

30 statements  

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

1import unittest 

2from mindsdb.integrations.handlers.monetdb_handler.monetdb_handler import MonetDBHandler 

3from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE 

4 

5 

6class MonetDBHandlerTest(unittest.TestCase): 

7 @classmethod 

8 def setUpClass(cls): 

9 cls.kwargs = { 

10 "connection_data": { 

11 "host": "127.0.0.1", 

12 "port": 50000, 

13 "user": "monetdb", 

14 "password": "monetdb", 

15 "database": "demo", 

16 } 

17 } 

18 cls.handler = MonetDBHandler("test_monet_handler", cls.kwargs) 

19 

20 def test_0_connect(self): 

21 self.handler.connect() 

22 

23 def test_1_drop_table(self): 

24 res = self.handler.query("DROP TABLE IF EXISTS PREM;") 

25 assert res.type is not RESPONSE_TYPE.ERROR 

26 

27 def test_2_create_table(self): 

28 res = self.handler.query("CREATE TABLE IF NOT EXISTS PREM (Premi varchar(50));") 

29 assert res.type is not RESPONSE_TYPE.ERROR 

30 

31 def test_3_insert_table(self): 

32 res = self.handler.query("INSERT INTO PREM VALUES('Radha <3 Krishna');") 

33 assert res.type is not RESPONSE_TYPE.ERROR 

34 

35 def test_4_get_tables(self): 

36 tables = self.handler.get_tables() 

37 assert tables.type is not RESPONSE_TYPE.ERROR 

38 

39 def test_5_select_query(self): 

40 query = "SELECT * FROM PREM;" 

41 result = self.handler.native_query(query) 

42 assert result.type is RESPONSE_TYPE.TABLE or RESPONSE_TYPE.OK 

43 

44 def test_6_check_connection(self): 

45 self.handler.check_connection() 

46 

47 

48if __name__ == "__main__": 

49 unittest.main()