예제 #1
0
 def test_list_to_string(self):
     lst = [('"FILE"', '200'), ('"FIELDS"', '@;.01;2;4;5;.141;8;9;11;29'),
            ('"FLAGS"', 'IP'), ('"MAX"', '1'), ('"FROM"', '545'),
            ('"XREF"', '#')]
     expected = "006\"FILE\"003200t008\"FIELDS\"026@;.01;2;4;5;.141;8;9;11;29t007\"FLAGS\"002IPt005\"MAX\"0011t006\"FROM\"003545t006\"XREF\"001#f"
     actual = RpcParameter.list_to_string(lst)
     self.assertEqual(expected, actual)
예제 #2
0
 def test_list_to_string(self):
     lst = [
         ('"FILE"', '200'),
         ('"FIELDS"', '@;.01;2;4;5;.141;8;9;11;29'),
         ('"FLAGS"', 'IP'),
         ('"MAX"', '1'),
         ('"FROM"', '545'),
         ('"XREF"', '#')
     ]
     expected = "006\"FILE\"003200t008\"FIELDS\"026@;.01;2;4;5;.141;8;9;11;29t007\"FLAGS\"002IPt005\"MAX\"0011t006\"FROM\"003545t006\"XREF\"001#f"
     actual = RpcParameter.list_to_string(lst)
     self.assertEqual(expected, actual)
예제 #3
0
 def prepare_param_str(params):
     param_str = '5'
     if params:
         for param in params:
             if param.type == RpcParameter.LITERAL:
                 param_str += '0' + VistaUtils.str_pack(param.value, VistaRpc.COUNT_WIDTH) + 'f'
             elif param.type == RpcParameter.REFERENCE:
                 param_str += '1' + VistaUtils.str_pack(param.value, VistaRpc.COUNT_WIDTH) + 'f'
             elif param.type == RpcParameter.LIST:
                 param_str += '2' + RpcParameter.list_to_string(param.value)
             else:
                 raise VistaException('Invalid param type')
     if param_str == '5' : param_str += '4f'
     return param_str
예제 #4
0
 def prepare_param_str(params):
     param_str = '5'
     if params:
         for param in params:
             if param.type == RpcParameter.LITERAL:
                 param_str += '0' + VistaUtils.str_pack(
                     param.value, VistaRpc.COUNT_WIDTH) + 'f'
             elif param.type == RpcParameter.REFERENCE:
                 param_str += '1' + VistaUtils.str_pack(
                     param.value, VistaRpc.COUNT_WIDTH) + 'f'
             elif param.type == RpcParameter.LIST:
                 param_str += '2' + RpcParameter.list_to_string(param.value)
             else:
                 raise VistaException('Invalid param type')
     if param_str == '5': param_str += '4f'
     return param_str