@@ -85,29 +85,23 @@ def test_finalized_block_height_return_none_when_no_number_field(self):
8585 result = self .evm_collector .finalized_block_height ()
8686 self .assertEqual (None , result )
8787
88- def test_finalized_block_height_return (self ):
89- """Tests that finalized_block_height converts hex block number to integer correctly"""
88+ def test_finalized_block_height_return_int (self ):
89+ """Tests that finalized_block_height returns integer block number correctly"""
9090 mock_block_response = {
91- "number" : "0x1a2b3c" ,
91+ "number" : 1715004 , # Already an integer, not hex string
9292 "hash" : "0x456def"
9393 }
9494 self .mocked_websocket .return_value .query .return_value = mock_block_response
9595 result = self .evm_collector .finalized_block_height ()
96- # 0x1a2b3c = 1715004 in decimal
9796 self .assertEqual (1715004 , result )
9897
99- def test_finalized_block_height_hex_conversion (self ):
100- """Tests that finalized_block_height handles various hex values correctly"""
101- test_cases = [
102- ("0x0" , 0 ),
103- ("0x1" , 1 ),
104- ("0xff" , 255 ),
105- ("0x1000" , 4096 )
106- ]
107-
108- for hex_value , expected_int in test_cases :
109- with self .subTest (hex_value = hex_value ):
110- mock_block_response = {"number" : hex_value }
98+ def test_finalized_block_height_various_integers (self ):
99+ """Tests that finalized_block_height handles various integer values correctly"""
100+ test_cases = [0 , 1 , 255 , 4096 , 1000000 ]
101+
102+ for expected_int in test_cases :
103+ with self .subTest (block_number = expected_int ):
104+ mock_block_response = {"number" : expected_int }
111105 self .mocked_websocket .return_value .query .return_value = mock_block_response
112106 result = self .evm_collector .finalized_block_height ()
113107 self .assertEqual (expected_int , result )
0 commit comments