@@ -45,9 +45,6 @@ def test_predicate_changes(self):
4545 external_event = True
4646 contact_point = DefaultEndPoint ("127.0.0.1" )
4747
48- single_host = {Host (contact_point , SimpleConvictionPolicy )}
49- all_hosts = {Host (DefaultEndPoint ("127.0.0.{}" .format (i )), SimpleConvictionPolicy ) for i in (1 , 2 , 3 )}
50-
5148 predicate = lambda host : host .endpoint == contact_point if external_event else True
5249 hfp = ExecutionProfile (
5350 load_balancing_policy = HostFilterPolicy (RoundRobinPolicy (), predicate = predicate )
@@ -62,7 +59,8 @@ def test_predicate_changes(self):
6259 response = session .execute ("SELECT * from system.local WHERE key='local'" )
6360 queried_hosts .update (response .response_future .attempted_hosts )
6461
65- assert queried_hosts == single_host
62+ assert len (queried_hosts ) == 1
63+ assert queried_hosts .pop ().endpoint == contact_point
6664
6765 external_event = False
6866 futures = session .update_created_pools ()
@@ -72,7 +70,8 @@ def test_predicate_changes(self):
7270 for _ in range (10 ):
7371 response = session .execute ("SELECT * from system.local WHERE key='local'" )
7472 queried_hosts .update (response .response_future .attempted_hosts )
75- assert queried_hosts == all_hosts
73+ assert len (queried_hosts ) == 3
74+ assert {host .endpoint for host in queried_hosts } == {DefaultEndPoint (f"127.0.0.{ i } " ) for i in range (1 , 4 )}
7675
7776
7877class WhiteListRoundRobinPolicyTests (unittest .TestCase ):
0 commit comments