Skip to content

Commit eea02f8

Browse files
Fixed Python warnings in test_sign
Also explicitely name all optional parameters
1 parent be53fee commit eea02f8

File tree

1 file changed

+41
-21
lines changed

1 file changed

+41
-21
lines changed

tests/ragger/test_sign.py

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ def common(firmware: Firmware,
8181
end_text = "Accept"
8282
else:
8383
end_text = r"(Sign|Accept (risk|threat))"
84-
scenario_navigator.review_approve(test_name=test_name, custom_screen_text=end_text, do_comparison=test_name!="")
84+
scenario_navigator.review_approve(test_name=test_name, custom_screen_text=end_text, do_comparison=test_name != "")
8585

8686
# verify signature
8787
vrs = ResponseParser.signature(app_client.response().data)
88-
if v is not None: # temporary until web3.py supports 7702
88+
if v is not None: # temporary until web3.py supports 7702
8989
print(vrs)
9090
print(v)
9191
print(r)
@@ -174,7 +174,14 @@ def test_sign_legacy_send_bsc(firmware: Firmware,
174174
"value": Web3.to_wei(AMOUNT2, "ether"),
175175
"chainId": 56
176176
}
177-
common(firmware, backend, navigator, scenario_navigator, default_screenshot_path, tx_params, None, test_name, BIP32_PATH2)
177+
common(firmware,
178+
backend,
179+
navigator,
180+
scenario_navigator,
181+
default_screenshot_path,
182+
tx_params,
183+
test_name=test_name,
184+
path=BIP32_PATH2)
178185

179186

180187
# Transfer on network 112233445566 on Ethereum
@@ -192,7 +199,14 @@ def test_sign_legacy_chainid(firmware: Firmware,
192199
"value": Web3.to_wei(AMOUNT2, "ether"),
193200
"chainId": 112233445566
194201
}
195-
common(firmware, backend, navigator, scenario_navigator, default_screenshot_path, tx_params, None, test_name, BIP32_PATH2)
202+
common(firmware,
203+
backend,
204+
navigator,
205+
scenario_navigator,
206+
default_screenshot_path,
207+
tx_params,
208+
test_name=test_name,
209+
path=BIP32_PATH2)
196210

197211

198212
def test_1559(firmware: Firmware,
@@ -232,9 +246,8 @@ def test_sign_simple(firmware: Firmware,
232246
scenario_navigator,
233247
default_screenshot_path,
234248
tx_params,
235-
None,
236-
test_name,
237-
BIP32_PATH2)
249+
test_name=test_name,
250+
path=BIP32_PATH2)
238251

239252

240253
def test_sign_limit_nonce(firmware: Firmware,
@@ -257,9 +270,8 @@ def test_sign_limit_nonce(firmware: Firmware,
257270
scenario_navigator,
258271
default_screenshot_path,
259272
tx_params,
260-
None,
261-
test_name,
262-
BIP32_PATH2)
273+
test_name=test_name,
274+
path=BIP32_PATH2)
263275

264276

265277
def test_sign_nonce_display(firmware: Firmware,
@@ -285,9 +297,9 @@ def test_sign_nonce_display(firmware: Firmware,
285297
scenario_navigator,
286298
default_screenshot_path,
287299
tx_params,
288-
None,
289-
test_name,
290-
BIP32_PATH2)
300+
test_name=test_name,
301+
path=BIP32_PATH2)
302+
291303

292304
def test_sign_reject(backend: BackendInterface, scenario_navigator: NavigateWithScenario):
293305
tx_params: dict = {
@@ -352,8 +364,8 @@ def test_sign_eip_2930(firmware: Firmware,
352364
scenario_navigator,
353365
default_screenshot_path,
354366
tx_params,
355-
None,
356-
test_name)
367+
test_name=test_name)
368+
357369

358370
def test_sign_eip_7702(firmware: Firmware,
359371
backend: BackendInterface,
@@ -364,11 +376,19 @@ def test_sign_eip_7702(firmware: Firmware,
364376
if firmware == Firmware.NANOS:
365377
pytest.skip("Not supported on LNS")
366378
tx_params = {
367-
"chainId" : 1
379+
"chainId": 1
368380
}
369381
tx_raw = bytes.fromhex("04f888018205390101825208941212121212121212121212121212121212121212872386f26fc1000080c0f85ef85c8094020202020202020202020202020202020202020282053901a0a24f35cafc6b408ce32539d4bd89a67edd4d6303fc676dfddf93b98405b7ee5ea0159456babe656692959ca3d829ca269e8f82387c91e40a33633d190dda7a3c5c")
370-
common(firmware, backend, navigator, scenario_navigator, default_screenshot_path, tx_params, tx_raw, test_name,
371-
BIP32_PATH, False,
372-
bytes.fromhex("01"),
373-
bytes.fromhex("9800 ce04 ecb4 6aeb de0f ea80 c663 9225 5eb1 3c3b 3597 aeec 2224 47f6 e1bf cfaf"),
374-
bytes.fromhex("787e b825 81e1 a51d 8956 f21a 0ccd 0b96 d8de 14b0 4c11 de0b 7dcb 5e40 0219 902b"))
382+
common(firmware,
383+
backend,
384+
navigator,
385+
scenario_navigator,
386+
default_screenshot_path,
387+
tx_params,
388+
tx_raw,
389+
test_name=test_name,
390+
path=BIP32_PATH,
391+
with_simu=False,
392+
v=bytes.fromhex("01"),
393+
r=bytes.fromhex("9800ce04ecb46aebde0fea80c66392255eb13c3b3597aeec222447f6e1bfcfaf"),
394+
s=bytes.fromhex("787eb82581e1a51d8956f21a0ccd0b96d8de14b04c11de0b7dcb5e400219902b"))

0 commit comments

Comments
 (0)