Skip to content

Commit 828133c

Browse files
committed
fixing _get_leader_for_partition unittests
1 parent 5e5d709 commit 828133c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/test_unit.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ def test_load_metadata(self, protocol, conn):
417417

418418
# client loads metadata at init
419419
client = KafkaClient(host='broker_1', port=4567)
420-
self.assertItemsEqual({
421-
TopicAndPartition('topic_1', 0): brokers[0],
420+
self.assertDictEqual({
421+
TopicAndPartition('topic_1', 0): brokers[1],
422422
TopicAndPartition('topic_noleader', 0): None,
423423
TopicAndPartition('topic_noleader', 1): None,
424424
TopicAndPartition('topic_3', 0): brokers[0],
@@ -443,7 +443,7 @@ def test_get_leader_for_partitions_reloads_metadata(self, protocol, conn):
443443
client = KafkaClient(host='broker_1', port=4567)
444444

445445
# topic metadata is loaded but empty
446-
self.assertItemsEqual({}, client.topics_to_brokers)
446+
self.assertDictEqual({}, client.topics_to_brokers)
447447

448448
topics['topic_no_partitions'] = {
449449
0: PartitionMetadata('topic_no_partitions', 0, 0, [0, 1], [0, 1])
@@ -455,7 +455,7 @@ def test_get_leader_for_partitions_reloads_metadata(self, protocol, conn):
455455
leader = client._get_leader_for_partition('topic_no_partitions', 0)
456456

457457
self.assertEqual(brokers[0], leader)
458-
self.assertItemsEqual({
458+
self.assertDictEqual({
459459
TopicAndPartition('topic_no_partitions', 0): brokers[0]},
460460
client.topics_to_brokers)
461461

@@ -475,7 +475,7 @@ def test_get_leader_for_unassigned_partitions(self, protocol, conn):
475475

476476
client = KafkaClient(host='broker_1', port=4567)
477477

478-
self.assertItemsEqual({}, client.topics_to_brokers)
478+
self.assertDictEqual({}, client.topics_to_brokers)
479479
self.assertRaises(
480480
PartitionUnavailableError,
481481
client._get_leader_for_partition,
@@ -500,7 +500,7 @@ def test_get_leader_returns_none_when_noleader(self, protocol, conn):
500500
protocol.decode_metadata_response.return_value = (brokers, topics)
501501

502502
client = KafkaClient(host='broker_1', port=4567)
503-
self.assertItemsEqual(
503+
self.assertDictEqual(
504504
{
505505
TopicAndPartition('topic_noleader', 0): None,
506506
TopicAndPartition('topic_noleader', 1): None

0 commit comments

Comments
 (0)