@@ -658,20 +658,20 @@ def test_describe_topics_api():
658658
659659 # Wrong argument type
660660 for args in [
661- [topic_names ],
662- ["test-topic-1" ],
663- [TopicCollection ([3 ])],
664- [TopicCollection (["correct" , 3 ])],
665- [TopicCollection ([None ])]
666- ]:
661+ [topic_names ],
662+ ["test-topic-1" ],
663+ [TopicCollection ([3 ])],
664+ [TopicCollection (["correct" , 3 ])],
665+ [TopicCollection ([None ])]
666+ ]:
667667 with pytest .raises (TypeError ):
668668 a .describe_topics (* args , ** kwargs )
669669
670670 # Wrong argument value
671671 for args in [
672- [TopicCollection (["" ])],
673- [TopicCollection (["correct" , "" ])]
674- ]:
672+ [TopicCollection (["" ])],
673+ [TopicCollection (["correct" , "" ])]
674+ ]:
675675 with pytest .raises (ValueError ):
676676 a .describe_topics (* args , ** kwargs )
677677
@@ -1053,13 +1053,13 @@ def test_list_offsets_api():
10531053
10541054 # Wrong option types
10551055 for kwargs in [
1056- {
1057- "isolation_level" : 10
1058- },
1059- {
1060- "request_timeout" : "test"
1061- }
1062- ]:
1056+ {
1057+ "isolation_level" : 10
1058+ },
1059+ {
1060+ "request_timeout" : "test"
1061+ }
1062+ ]:
10631063 requests = {
10641064 TopicPartition ("topic1" , 0 , 10 ): OffsetSpec .earliest ()
10651065 }
@@ -1068,10 +1068,10 @@ def test_list_offsets_api():
10681068
10691069 # Wrong option values
10701070 for kwargs in [
1071- {
1072- "request_timeout" : - 1
1073- }
1074- ]:
1071+ {
1072+ "request_timeout" : - 1
1073+ }
1074+ ]:
10751075 requests = {
10761076 TopicPartition ("topic1" , 0 , 10 ): OffsetSpec .earliest ()
10771077 }
@@ -1095,13 +1095,13 @@ def test_list_offsets_api():
10951095
10961096 # Invalid TopicPartition
10971097 for requests in [
1098- {
1099- TopicPartition ("" , 0 , 10 ): OffsetSpec .earliest ()
1100- },
1101- {
1102- TopicPartition ("correct" , - 1 , 10 ): OffsetSpec .earliest ()
1103- }
1104- ]:
1098+ {
1099+ TopicPartition ("" , 0 , 10 ): OffsetSpec .earliest ()
1100+ },
1101+ {
1102+ TopicPartition ("correct" , - 1 , 10 ): OffsetSpec .earliest ()
1103+ }
1104+ ]:
11051105 with pytest .raises (ValueError ):
11061106 a .list_offsets (requests , ** kwargs )
11071107
@@ -1131,33 +1131,33 @@ def test_list_offsets_api():
11311131
11321132 # Key isn't a TopicPartition
11331133 for requests in [
1134- {
1135- "not-topic-partition" : OffsetSpec .latest ()
1136- },
1137- {
1138- TopicPartition ("topic1" , 0 , 10 ): OffsetSpec .latest (),
1139- "not-topic-partition" : OffsetSpec .latest ()
1140- },
1141- {
1142- None : OffsetSpec .latest ()
1143- }
1144- ]:
1134+ {
1135+ "not-topic-partition" : OffsetSpec .latest ()
1136+ },
1137+ {
1138+ TopicPartition ("topic1" , 0 , 10 ): OffsetSpec .latest (),
1139+ "not-topic-partition" : OffsetSpec .latest ()
1140+ },
1141+ {
1142+ None : OffsetSpec .latest ()
1143+ }
1144+ ]:
11451145 with pytest .raises (TypeError ):
11461146 a .list_offsets (requests , ** kwargs )
11471147
11481148 # Value isn't a OffsetSpec
11491149 for requests in [
1150- {
1151- TopicPartition ("topic1" , 0 , 10 ): "test"
1152- },
1153- {
1154- TopicPartition ("topic1" , 0 , 10 ): OffsetSpec .latest (),
1155- TopicPartition ("topic1" , 0 , 10 ): "test"
1156- },
1157- {
1158- TopicPartition ("topic1" , 0 , 10 ): None
1159- }
1160- ]:
1150+ {
1151+ TopicPartition ("topic1" , 0 , 10 ): "test"
1152+ },
1153+ {
1154+ TopicPartition ("topic1" , 0 , 10 ): OffsetSpec .latest (),
1155+ TopicPartition ("topic1" , 0 , 10 ): "test"
1156+ },
1157+ {
1158+ TopicPartition ("topic1" , 0 , 10 ): None
1159+ }
1160+ ]:
11611161 with pytest .raises (TypeError ):
11621162 a .list_offsets (requests , ** kwargs )
11631163
@@ -1226,8 +1226,6 @@ def test_elect_leaders():
12261226 .result (timeout = 1 )
12271227
12281228
1229- @pytest .mark .skipif (libversion ()[1 ] < 0x000b0500 ,
1230- reason = "AdminAPI requires librdkafka >= v0.11.5" )
12311229def test_admin_callback_exception_no_system_error ():
12321230 """Test AdminClient callbacks exception handling with different exception types"""
12331231
@@ -1275,10 +1273,9 @@ def error_cb_runtime_error(error):
12751273 assert "RuntimeError from error_cb" in str (exc_info .value )
12761274
12771275
1278- @pytest .mark .skipif (libversion ()[1 ] < 0x000b0500 ,
1279- reason = "AdminAPI requires librdkafka >= v0.11.5" )
12801276def test_admin_multiple_callbacks_different_error_types ():
1281- """Test AdminClient with multiple callbacks configured with different error types to see which one gets triggered"""
1277+ """Test AdminClient with multiple callbacks configured with different error types
1278+ to see which one gets triggered"""
12821279
12831280 callbacks_called = []
12841281
@@ -1304,9 +1301,9 @@ def throttle_cb_that_raises_kafka(throttle_event):
13041301 })
13051302
13061303 # Test that error_cb callback raises an exception (it's triggered by connection failures)
1307- with pytest .raises (RuntimeError ) as exc_info :
1304+ with pytest .raises (RuntimeError ):
13081305 admin .poll (timeout = 0.2 )
13091306
13101307 # Verify that error_cb was called
13111308 assert len (callbacks_called ) > 0
1312- assert 'error_cb_runtime' in callbacks_called
1309+ assert 'error_cb_runtime' in callbacks_called
0 commit comments