<s> import pytest <EOL> import sys <EOL> from . test_base_class import TestBaseClass <EOL> from aerospike import exception as e <EOL> aerospike = pytest . importorskip ( "<STR_LIT>" ) <EOL> try : <EOL> import aerospike <EOL> except : <EOL> print ( "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> class TestUdfList ( TestBaseClass ) : <EOL> def setup_class ( cls ) : <EOL> """<STR_LIT>""" <EOL> hostlist , user , password = TestBaseClass . get_hosts ( ) <EOL> config = { '<STR_LIT>' : hostlist } <EOL> if user is None and password is None : <EOL> TestUdfList . client = aerospike . client ( config ) . connect ( ) <EOL> else : <EOL> TestUdfList . client = aerospike . client ( config ) . connect ( user , <EOL> password ) <EOL> TestUdfList . client . udf_put ( '<STR_LIT>' , <NUM_LIT:0> , { } ) <EOL> def teardown_class ( cls ) : <EOL> """<STR_LIT>""" <EOL> TestUdfList . client . udf_remove ( "<STR_LIT>" ) <EOL> TestUdfList . client . close ( ) <EOL> def test_udf_list_without_any_paramter ( self ) : <EOL> ulist = TestUdfList . client . udf_list ( ) <EOL> assert type ( ulist ) is list <EOL> def test_udf_list_with_proper_parameters ( self ) : <EOL> policy = { '<STR_LIT>' : <NUM_LIT:0> } <EOL> udf_list = TestUdfList . client . udf_list ( policy ) <EOL> present = False <EOL> for udf in udf_list : <EOL> if '<STR_LIT>' == udf [ '<STR_LIT:name>' ] : <EOL> present = True <EOL> assert True if present else False <EOL> def test_udf_list_with_timeout_policy ( self ) : <EOL> policy = { '<STR_LIT>' : <NUM_LIT:1000> } <EOL> udf_list = TestUdfList . client . udf_list ( policy ) <EOL> present = False <EOL> for udf in udf_list : <EOL> if '<STR_LIT>' == udf [ '<STR_LIT:name>' ] : <EOL> present = True <EOL> assert True if present else False <EOL> def test_udf_list_with_invalid_timeout_policy_value ( self ) : <EOL> policy = { '<STR_LIT>' : <NUM_LIT:0.1> } <EOL> try : <EOL> TestUdfList . client . udf_list ( policy ) <EOL> except e . ParamError as exception : <EOL> assert exception . code == - <NUM_LIT:2> <EOL> assert exception . msg == '<STR_LIT>' <EOL> def test_udf_list_with_proper_parameters_without_connection ( self ) : <EOL> config = { '<STR_LIT>' : [ ( '<STR_LIT:127.0.0.1>' , <NUM_LIT> ) ] } <EOL> client1 = aerospike . client ( config ) <EOL> policy = { '<STR_LIT>' : <NUM_LIT:0> } <EOL> try : <EOL> client1 . udf_list ( policy ) <EOL> except e . ClusterError as exception : <EOL> assert exception . code == <NUM_LIT:11> <EOL> assert exception . msg == '<STR_LIT>' </s>
