Skip to content

Commit 143a673

Browse files
committed
ruff
1 parent 11356a1 commit 143a673

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

tests/test_sniff.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
from unittest.mock import patch
22

3-
from confluent_kafka.admin import ClusterMetadata, BrokerMetadata, TopicMetadata
3+
from confluent_kafka.admin import BrokerMetadata, ClusterMetadata, TopicMetadata
44

55
from saluki.sniff import sniff
66

7+
78
def test_sniff_with_two_partitions_in_a_topic():
8-
with patch("saluki.sniff.AdminClient") as a, patch("saluki.sniff.Consumer") as c, patch("saluki.sniff.logger") as logger:
9+
with (
10+
patch("saluki.sniff.AdminClient") as a,
11+
patch("saluki.sniff.Consumer") as c,
12+
patch("saluki.sniff.logger") as logger,
13+
):
914
fake_cluster_md = ClusterMetadata()
1015
broker1 = BrokerMetadata()
1116
broker1.id = "id1"
@@ -14,16 +19,13 @@ def test_sniff_with_two_partitions_in_a_topic():
1419
fake_cluster_md.brokers = {0: broker1}
1520

1621
topic1 = TopicMetadata()
17-
topic1.partitions = {0:{}}
22+
topic1.partitions = {0: {}}
1823
topic2 = TopicMetadata()
19-
topic2.partitions = {0:{}, 1:{}}
24+
topic2.partitions = {0: {}, 1: {}}
2025

21-
fake_cluster_md.topics = {
22-
"topic1": topic1,
23-
"topic2": topic2
24-
}
26+
fake_cluster_md.topics = {"topic1": topic1, "topic2": topic2}
2527
a().list_topics.return_value = fake_cluster_md
26-
c().get_watermark_offsets.return_value = 1,2
28+
c().get_watermark_offsets.return_value = 1, 2
2729
sniff("whatever")
2830

2931
brokers_call = logger.info.call_args_list[2]
@@ -38,4 +40,3 @@ def test_sniff_with_two_partitions_in_a_topic():
3840

3941
topic2_call2 = logger.info.call_args_list[8]
4042
assert "1 - low:1, high:2, num_messages:1" in topic2_call2.args[0]
41-

tests/test_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from streaming_data_types.forwarder_config_update_fc00 import (
77
ConfigurationUpdate,
88
StreamInfo,
9-
serialise_fc00
9+
serialise_fc00,
1010
)
1111

1212
from saluki.utils import (
@@ -87,7 +87,9 @@ def test_deserialising_with_schema_list_ignores_messages_with_schema_not_in_list
8787
mock_message.error.return_value = False
8888
mock_message.timestamp.return_value = 2, 1
8989

90-
deserialise_and_print_messages([mock_message, ok_message], None, schemas_to_filter_to=["fc00"])
90+
deserialise_and_print_messages(
91+
[mock_message, ok_message], None, schemas_to_filter_to=["fc00"]
92+
)
9193
assert logger.info.call_count == 1
9294

9395

0 commit comments

Comments
 (0)