Coverage for mindsdb / api / mysql / mysql_proxy / data_types / mysql_packets / column_count_packet.py: 42%

20 statements  

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

1""" 

2******************************************************* 

3 * Copyright (C) 2017 MindsDB Inc. <copyright@mindsdb.com> 

4 * 

5 * This file is part of MindsDB Server. 

6 * 

7 * MindsDB Server can not be copied and/or distributed without the express 

8 * permission of MindsDB Inc 

9 ******************************************************* 

10""" 

11 

12from mindsdb.api.mysql.mysql_proxy.data_types.mysql_datum import Datum 

13from mindsdb.api.mysql.mysql_proxy.data_types.mysql_packet import Packet 

14 

15 

16class ColumnCountPacket(Packet): 

17 def setup(self): 

18 count = self._kwargs.get('count', 0) 

19 self.column_count = Datum('int<lenenc>', count) 

20 

21 @property 

22 def body(self): 

23 

24 order = [ 

25 'column_count' 

26 ] 

27 

28 string = b'' 

29 for key in order: 

30 string += getattr(self, key).toStringPacket() 

31 

32 self.setBody(string) 

33 return self._body 

34 

35 @staticmethod 

36 def test(): 

37 import pprint 

38 pprint.pprint( 

39 str(ColumnCountPacket(count=1).get_packet_string()) 

40 ) 

41 

42 

43if __name__ == "__main__": 43 ↛ 44line 43 didn't jump to line 44 because the condition on line 43 was never true

44 ColumnCountPacket.test()