@@ -376,9 +376,7 @@ def _normalize_address(web3, addr: str) -> str:
376376class TestAddIpsToGroupAndRemoveIpsFromGroup :
377377 """Integration tests for add_ips_to_group and remove_ips_from_group with strict on-chain verification."""
378378
379- def test_add_ips_to_group (
380- self , story_client : StoryClient , nft_collection : Address
381- ):
379+ def test_add_ips_to_group (self , story_client : StoryClient , nft_collection : Address ):
382380 """Test adding IPs to an existing group; verify chain state via AddedIpToGroup event and get_claimable_reward."""
383381 result1 = GroupTestHelper .mint_and_register_ip_asset_with_pil_terms (
384382 story_client , nft_collection
@@ -403,17 +401,19 @@ def test_add_ips_to_group(
403401 assert isinstance (result ["tx_hash" ], str )
404402 assert len (result ["tx_hash" ]) > 0
405403 # Strict: verify on-chain AddedIpToGroup event
406- assert "tx_receipt" in result , "add_ips_to_group must return tx_receipt for verification"
404+ assert (
405+ "tx_receipt" in result
406+ ), "add_ips_to_group must return tx_receipt for verification"
407407 added_events = story_client .Group .get_added_ip_to_group_events (
408408 result ["tx_receipt" ]
409409 )
410410 assert len (added_events ) == 1
411- assert _normalize_address (story_client . web3 , added_events [ 0 ][ "groupId" ]) == _normalize_address (
412- story_client .web3 , group_ip_id
413- )
414- assert set (_normalize_address ( story_client . web3 , a ) for a in added_events [ 0 ][ "ipIds" ]) == {
415- _normalize_address (story_client .web3 , ip_id2 )
416- }
411+ assert _normalize_address (
412+ story_client .web3 , added_events [ 0 ][ "groupId" ]
413+ ) == _normalize_address ( story_client . web3 , group_ip_id )
414+ assert set (
415+ _normalize_address (story_client .web3 , a ) for a in added_events [ 0 ][ "ipIds" ]
416+ ) == { _normalize_address ( story_client . web3 , ip_id2 ) }
417417 # Verify new member is in group: get_claimable_reward for [ip_id1, ip_id2] should succeed
418418 claimable = story_client .Group .get_claimable_reward (
419419 group_ip_id = group_ip_id ,
@@ -454,12 +454,12 @@ def test_add_ips_to_group_with_max_reward_share(
454454 result ["tx_receipt" ]
455455 )
456456 assert len (added_events ) == 1
457- assert _normalize_address (story_client . web3 , added_events [ 0 ][ "groupId" ]) == _normalize_address (
458- story_client .web3 , group_ip_id
459- )
460- assert set (_normalize_address ( story_client . web3 , a ) for a in added_events [ 0 ][ "ipIds" ]) == {
461- _normalize_address (story_client .web3 , ip_id2 )
462- }
457+ assert _normalize_address (
458+ story_client .web3 , added_events [ 0 ][ "groupId" ]
459+ ) == _normalize_address ( story_client . web3 , group_ip_id )
460+ assert set (
461+ _normalize_address (story_client .web3 , a ) for a in added_events [ 0 ][ "ipIds" ]
462+ ) == { _normalize_address ( story_client . web3 , ip_id2 ) }
463463
464464 def test_remove_ips_from_group (
465465 self , story_client : StoryClient , nft_collection : Address
@@ -492,12 +492,12 @@ def test_remove_ips_from_group(
492492 result ["tx_receipt" ]
493493 )
494494 assert len (removed_events ) == 1
495- assert _normalize_address (story_client . web3 , removed_events [ 0 ][ "groupId" ]) == _normalize_address (
496- story_client .web3 , group_ip_id
497- )
498- assert set (_normalize_address ( story_client . web3 , a ) for a in removed_events [ 0 ][ "ipIds" ]) == {
499- _normalize_address (story_client .web3 , ip_id2 )
500- }
495+ assert _normalize_address (
496+ story_client .web3 , removed_events [ 0 ][ "groupId" ]
497+ ) == _normalize_address ( story_client . web3 , group_ip_id )
498+ assert set (
499+ _normalize_address (story_client .web3 , a ) for a in removed_events [ 0 ][ "ipIds" ]
500+ ) == { _normalize_address ( story_client . web3 , ip_id2 ) }
501501 # After remove, only ip_id1 remains; get_claimable_reward for [ip_id1] must succeed
502502 claimable = story_client .Group .get_claimable_reward (
503503 group_ip_id = group_ip_id ,
@@ -540,7 +540,9 @@ def test_add_then_remove_ips_from_group(
540540 add_result ["tx_receipt" ]
541541 )
542542 assert len (added_events ) == 1
543- assert set (_normalize_address (story_client .web3 , a ) for a in added_events [0 ]["ipIds" ]) == {
543+ assert set (
544+ _normalize_address (story_client .web3 , a ) for a in added_events [0 ]["ipIds" ]
545+ ) == {
544546 _normalize_address (story_client .web3 , ip_id2 ),
545547 _normalize_address (story_client .web3 , ip_id3 ),
546548 }
@@ -556,9 +558,9 @@ def test_add_then_remove_ips_from_group(
556558 remove_result ["tx_receipt" ]
557559 )
558560 assert len (removed_events ) == 1
559- assert set (_normalize_address ( story_client . web3 , a ) for a in removed_events [ 0 ][ "ipIds" ]) == {
560- _normalize_address (story_client .web3 , ip_id2 )
561- }
561+ assert set (
562+ _normalize_address (story_client .web3 , a ) for a in removed_events [ 0 ][ "ipIds" ]
563+ ) == { _normalize_address ( story_client . web3 , ip_id2 ) }
562564
563565 # Final state: only ip_id1 and ip_id3 are members
564566 claimable = story_client .Group .get_claimable_reward (
0 commit comments