File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import contextlib
12from decimal import Decimal
23
34import pytest
@@ -19,11 +20,8 @@ def test_query_is_built_correctly(self):
1920 "errors" : [],
2021 },
2122 )
22- try :
23+ with contextlib . suppress ( KeyError ) :
2324 get_address ("test_hash_123" )
24- except KeyError :
25- # catch where get_address_info fails to serialize mis-built response
26- pass
2725
2826 query = m .last_request .json ()["query" ]
2927 assert 'address(hash: "test_hash_123") {' in query
@@ -88,17 +86,14 @@ def test_query_is_built_correctly(self):
8886 "errors" : [],
8987 },
9088 )
91- try :
89+ with contextlib . suppress ( KeyError ) :
9290 get_addresses (
9391 [
9492 "hash_1" ,
9593 "hash_2" ,
9694 "hash_3" ,
9795 ]
9896 )
99- except KeyError :
100- # catch where get_address_info fails to serialize mis-built response
101- pass
10297
10398 query = m .last_request .json ()["query" ]
10499 assert 'addresses(hashes: ["hash_1", "hash_2", "hash_3"]) {' in query
Original file line number Diff line number Diff line change 1+ import contextlib
12from datetime import datetime , timezone
23from decimal import Decimal
34
@@ -18,11 +19,8 @@ def test_query_is_built_correctly(self):
1819 "errors" : [],
1920 },
2021 )
21- try :
22+ with contextlib . suppress ( KeyError ) :
2223 get_block (123 )
23- except KeyError :
24- # catch where get_block_info fails to serialize mis-built response
25- pass
2624
2725 query = m .last_request .json ()["query" ]
2826 assert "block(number: 123)" in query
Original file line number Diff line number Diff line change 1+ import contextlib
12from decimal import Decimal
23
34import requests_mock
@@ -17,11 +18,8 @@ def test_query_is_built_correctly(self):
1718 "errors" : [],
1819 },
1920 )
20- try :
21+ with contextlib . suppress ( KeyError ) :
2122 get_token_transfers ("hash" , previous_cursor = "prev" )
22- except KeyError :
23- # catch where get_token_transfers fails to serialize mis-built response
24- pass
2523
2624 query = m .last_request .json ()["query" ]
2725 assert (
Original file line number Diff line number Diff line change 1+ import contextlib
12from decimal import Decimal
23
34import requests_mock
@@ -23,11 +24,8 @@ def test_query_is_built_correctly(self):
2324 "errors" : [],
2425 },
2526 )
26- try :
27+ with contextlib . suppress ( KeyError ) :
2728 get_transaction ("test_hash_123" )
28- except KeyError :
29- # catch where get_transaction_info fails to serialize mis-built response
30- pass
3129
3230 query = m .last_request .json ()["query" ]
3331 assert 'transaction(hash: "test_hash_123")' in query
@@ -113,11 +111,8 @@ def test_query_is_built_correctly(self):
113111 "errors" : [],
114112 },
115113 )
116- try :
114+ with contextlib . suppress ( TypeError ) :
117115 get_internal_transactions ("hash" , previous_cursor = "prev" )
118- except TypeError :
119- # catch where get_internal_transactions fails to serialize mis-built response
120- pass
121116
122117 query = m .last_request .json ()["query" ]
123118 assert 'transaction(hash: "hash") {' in query
@@ -304,11 +299,8 @@ def test_query_is_built_correctly(self):
304299 "errors" : [],
305300 },
306301 )
307- try :
302+ with contextlib . suppress ( KeyError ) :
308303 get_transactions_from_address ("hash" , previous_cursor = "prev" )
309- except KeyError :
310- # catch where get_internal_transactions fails to serialize mis-built response
311- pass
312304
313305 query = m .last_request .json ()["query" ]
314306 assert 'address(hash: "hash") {' in query
You can’t perform that action at this time.
0 commit comments