<s> from rc . redis_cluster import RedisCluster , HostConfig <EOL> def test_cluster_constructor ( ) : <EOL> cluster = RedisCluster ( { <EOL> <NUM_LIT:0> : { '<STR_LIT:password>' : '<STR_LIT>' , '<STR_LIT>' : True } , <EOL> <NUM_LIT:1> : { '<STR_LIT:host>' : '<STR_LIT:127.0.0.1>' , '<STR_LIT:port>' : <NUM_LIT> , '<STR_LIT>' : <NUM_LIT:1> } , <EOL> <NUM_LIT:2> : { '<STR_LIT>' : '<STR_LIT>' } , <EOL> } ) <EOL> assert cluster . hosts [ <NUM_LIT:0> ] . host_name == <NUM_LIT:0> <EOL> assert cluster . hosts [ <NUM_LIT:0> ] . host == '<STR_LIT:localhost>' <EOL> assert cluster . hosts [ <NUM_LIT:0> ] . port == <NUM_LIT> <EOL> assert cluster . hosts [ <NUM_LIT:0> ] . unix_socket_path is None <EOL> assert cluster . hosts [ <NUM_LIT:0> ] . db == <NUM_LIT:0> <EOL> assert cluster . hosts [ <NUM_LIT:0> ] . password == '<STR_LIT>' <EOL> assert cluster . hosts [ <NUM_LIT:0> ] . ssl is True <EOL> assert cluster . hosts [ <NUM_LIT:0> ] . ssl_options is None <EOL> assert cluster . hosts [ <NUM_LIT:1> ] . host_name == <NUM_LIT:1> <EOL> assert cluster . hosts [ <NUM_LIT:1> ] . host == '<STR_LIT:127.0.0.1>' <EOL> assert cluster . hosts [ <NUM_LIT:1> ] . port == <NUM_LIT> <EOL> assert cluster . hosts [ <NUM_LIT:1> ] . unix_socket_path is None <EOL> assert cluster . hosts [ <NUM_LIT:1> ] . db == <NUM_LIT:1> <EOL> assert cluster . hosts [ <NUM_LIT:1> ] . password is None <EOL> assert cluster . hosts [ <NUM_LIT:1> ] . ssl is False <EOL> assert cluster . hosts [ <NUM_LIT:1> ] . ssl_options is None <EOL> assert cluster . hosts [ <NUM_LIT:2> ] . host_name == <NUM_LIT:2> <EOL> assert cluster . hosts [ <NUM_LIT:2> ] . host == '<STR_LIT:localhost>' <EOL> assert cluster . hosts [ <NUM_LIT:2> ] . port == <NUM_LIT> <EOL> assert cluster . hosts [ <NUM_LIT:2> ] . unix_socket_path == '<STR_LIT>' <EOL> assert cluster . hosts [ <NUM_LIT:2> ] . db == <NUM_LIT:0> <EOL> assert cluster . hosts [ <NUM_LIT:2> ] . password is None <EOL> assert cluster . hosts [ <NUM_LIT:2> ] . ssl is False <EOL> assert cluster . hosts [ <NUM_LIT:2> ] . ssl_options is None <EOL> def test_host_config ( ) : <EOL> host_config_01 = HostConfig ( '<STR_LIT>' ) <EOL> host_config_02 = HostConfig ( '<STR_LIT>' , password = '<STR_LIT>' , ssl = False ) <EOL> assert repr ( host_config_01 ) == repr ( host_config_02 ) <EOL> def test_cluster_pools ( ) : <EOL> cluster = RedisCluster ( { <EOL> <NUM_LIT:0> : { '<STR_LIT:password>' : '<STR_LIT>' , '<STR_LIT>' : True } , <EOL> <NUM_LIT:1> : { '<STR_LIT>' : '<STR_LIT>' } , <EOL> } ) <EOL> pool_for_0 = cluster . get_pool_of_host ( <NUM_LIT:0> ) <EOL> pool_for_1 = cluster . get_pool_of_host ( <NUM_LIT:1> ) <EOL> pool_for_0_again = cluster . get_pool_of_host ( <NUM_LIT:0> ) <EOL> assert pool_for_0 is pool_for_0_again <EOL> assert pool_for_0 is not pool_for_1 </s>
