mirror of
https://github.com/aljazceru/nutshell.git
synced 2026-02-18 07:04:21 +01:00
[DEV] add ruff and remove isort and flake (#300)
* [DEV] add ruff and remove isort and flake - precommit - workflow - Makefile updated black * configure black to use default line-length * reformat to 88 chars line-length * fix ugly comments
This commit is contained in:
@@ -94,7 +94,7 @@ async def test_get_keys(wallet1: Wallet):
|
||||
assert len(wallet1.keys.public_keys) == settings.max_order
|
||||
keyset = await wallet1._get_keys(wallet1.url)
|
||||
assert keyset.id is not None
|
||||
assert type(keyset.id) == str
|
||||
assert isinstance(keyset.id, str)
|
||||
assert len(keyset.id) > 0
|
||||
|
||||
|
||||
@@ -244,9 +244,7 @@ async def test_duplicate_proofs_double_spent(wallet1: Wallet):
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_and_redeem(wallet1: Wallet, wallet2: Wallet):
|
||||
await wallet1.mint(64)
|
||||
_, spendable_proofs = await wallet1.split_to_send( # type: ignore
|
||||
wallet1.proofs, 32, set_reserved=True
|
||||
)
|
||||
_, spendable_proofs = await wallet1.split_to_send(wallet1.proofs, 32, set_reserved=True) # type: ignore
|
||||
await wallet2.redeem(spendable_proofs)
|
||||
assert wallet2.balance == 32
|
||||
|
||||
@@ -325,7 +323,8 @@ async def test_token_state(wallet1: Wallet):
|
||||
@pytest.mark.asyncio
|
||||
async def test_bump_secret_derivation(wallet3: Wallet):
|
||||
await wallet3._init_private_key(
|
||||
"half depart obvious quality work element tank gorilla view sugar picture humble"
|
||||
"half depart obvious quality work element tank gorilla view sugar picture"
|
||||
" humble"
|
||||
)
|
||||
secrets1, rs1, derivaion_paths1 = await wallet3.generate_n_secrets(5)
|
||||
secrets2, rs2, derivaion_paths2 = await wallet3.generate_secrets_from_to(0, 4)
|
||||
@@ -351,7 +350,8 @@ async def test_bump_secret_derivation(wallet3: Wallet):
|
||||
@pytest.mark.asyncio
|
||||
async def test_bump_secret_derivation_two_steps(wallet3: Wallet):
|
||||
await wallet3._init_private_key(
|
||||
"half depart obvious quality work element tank gorilla view sugar picture humble"
|
||||
"half depart obvious quality work element tank gorilla view sugar picture"
|
||||
" humble"
|
||||
)
|
||||
secrets1_1, rs1_1, derivaion_paths1 = await wallet3.generate_n_secrets(2)
|
||||
secrets1_2, rs1_2, derivaion_paths2 = await wallet3.generate_n_secrets(3)
|
||||
@@ -365,7 +365,8 @@ async def test_bump_secret_derivation_two_steps(wallet3: Wallet):
|
||||
@pytest.mark.asyncio
|
||||
async def test_generate_secrets_from_to(wallet3: Wallet):
|
||||
await wallet3._init_private_key(
|
||||
"half depart obvious quality work element tank gorilla view sugar picture humble"
|
||||
"half depart obvious quality work element tank gorilla view sugar picture"
|
||||
" humble"
|
||||
)
|
||||
secrets1, rs1, derivaion_paths1 = await wallet3.generate_secrets_from_to(0, 4)
|
||||
assert len(secrets1) == 5
|
||||
@@ -392,7 +393,8 @@ async def test_restore_wallet_after_mint(wallet3: Wallet):
|
||||
async def test_restore_wallet_with_invalid_mnemonic(wallet3: Wallet):
|
||||
await assert_err(
|
||||
wallet3._init_private_key(
|
||||
"half depart obvious quality work element tank gorilla view sugar picture picture"
|
||||
"half depart obvious quality work element tank gorilla view sugar picture"
|
||||
" picture"
|
||||
),
|
||||
"Invalid mnemonic",
|
||||
)
|
||||
@@ -401,16 +403,15 @@ async def test_restore_wallet_with_invalid_mnemonic(wallet3: Wallet):
|
||||
@pytest.mark.asyncio
|
||||
async def test_restore_wallet_after_split_to_send(wallet3: Wallet):
|
||||
await wallet3._init_private_key(
|
||||
"half depart obvious quality work element tank gorilla view sugar picture humble"
|
||||
"half depart obvious quality work element tank gorilla view sugar picture"
|
||||
" humble"
|
||||
)
|
||||
await reset_wallet_db(wallet3)
|
||||
|
||||
await wallet3.mint(64)
|
||||
assert wallet3.balance == 64
|
||||
|
||||
_, spendable_proofs = await wallet3.split_to_send( # type: ignore
|
||||
wallet3.proofs, 32, set_reserved=True
|
||||
)
|
||||
_, spendable_proofs = await wallet3.split_to_send(wallet3.proofs, 32, set_reserved=True) # type: ignore
|
||||
|
||||
await reset_wallet_db(wallet3)
|
||||
await wallet3.load_proofs()
|
||||
@@ -432,9 +433,7 @@ async def test_restore_wallet_after_send_and_receive(wallet3: Wallet, wallet2: W
|
||||
await wallet3.mint(64)
|
||||
assert wallet3.balance == 64
|
||||
|
||||
_, spendable_proofs = await wallet3.split_to_send( # type: ignore
|
||||
wallet3.proofs, 32, set_reserved=True
|
||||
)
|
||||
_, spendable_proofs = await wallet3.split_to_send(wallet3.proofs, 32, set_reserved=True) # type: ignore
|
||||
|
||||
await wallet2.redeem(spendable_proofs)
|
||||
|
||||
@@ -465,16 +464,15 @@ class ProofBox:
|
||||
@pytest.mark.asyncio
|
||||
async def test_restore_wallet_after_send_and_self_receive(wallet3: Wallet):
|
||||
await wallet3._init_private_key(
|
||||
"lucky broken tell exhibit shuffle tomato ethics virus rabbit spread measure text"
|
||||
"lucky broken tell exhibit shuffle tomato ethics virus rabbit spread measure"
|
||||
" text"
|
||||
)
|
||||
await reset_wallet_db(wallet3)
|
||||
|
||||
await wallet3.mint(64)
|
||||
assert wallet3.balance == 64
|
||||
|
||||
_, spendable_proofs = await wallet3.split_to_send( # type: ignore
|
||||
wallet3.proofs, 32, set_reserved=True
|
||||
)
|
||||
_, spendable_proofs = await wallet3.split_to_send(wallet3.proofs, 32, set_reserved=True) # type: ignore
|
||||
|
||||
await wallet3.redeem(spendable_proofs)
|
||||
|
||||
@@ -500,9 +498,7 @@ async def test_restore_wallet_after_send_twice(
|
||||
box.add(wallet3.proofs)
|
||||
assert wallet3.balance == 2
|
||||
|
||||
keep_proofs, spendable_proofs = await wallet3.split_to_send( # type: ignore
|
||||
wallet3.proofs, 1, set_reserved=True
|
||||
)
|
||||
keep_proofs, spendable_proofs = await wallet3.split_to_send(wallet3.proofs, 1, set_reserved=True) # type: ignore
|
||||
box.add(wallet3.proofs)
|
||||
assert wallet3.available_balance == 1
|
||||
await wallet3.redeem(spendable_proofs)
|
||||
@@ -522,9 +518,7 @@ async def test_restore_wallet_after_send_twice(
|
||||
|
||||
# again
|
||||
|
||||
_, spendable_proofs = await wallet3.split_to_send( # type: ignore
|
||||
wallet3.proofs, 1, set_reserved=True
|
||||
)
|
||||
_, spendable_proofs = await wallet3.split_to_send(wallet3.proofs, 1, set_reserved=True) # type: ignore
|
||||
box.add(wallet3.proofs)
|
||||
|
||||
assert wallet3.available_balance == 1
|
||||
@@ -557,9 +551,7 @@ async def test_restore_wallet_after_send_and_self_receive_nonquadratic_value(
|
||||
box.add(wallet3.proofs)
|
||||
assert wallet3.balance == 64
|
||||
|
||||
keep_proofs, spendable_proofs = await wallet3.split_to_send( # type: ignore
|
||||
wallet3.proofs, 10, set_reserved=True
|
||||
)
|
||||
keep_proofs, spendable_proofs = await wallet3.split_to_send(wallet3.proofs, 10, set_reserved=True) # type: ignore
|
||||
box.add(wallet3.proofs)
|
||||
|
||||
assert wallet3.available_balance == 64 - 10
|
||||
@@ -579,9 +571,7 @@ async def test_restore_wallet_after_send_and_self_receive_nonquadratic_value(
|
||||
|
||||
# again
|
||||
|
||||
_, spendable_proofs = await wallet3.split_to_send( # type: ignore
|
||||
wallet3.proofs, 12, set_reserved=True
|
||||
)
|
||||
_, spendable_proofs = await wallet3.split_to_send(wallet3.proofs, 12, set_reserved=True) # type: ignore
|
||||
|
||||
assert wallet3.available_balance == 64 - 12
|
||||
await wallet3.redeem(spendable_proofs)
|
||||
|
||||
Reference in New Issue
Block a user