mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 15:08:25 +00:00
cleanup
This commit is contained in:
@@ -73,25 +73,25 @@ def test_calculate_checksum_invalid_mnemonics():
|
|||||||
with pytest.raises(Exception) as e:
|
with pytest.raises(Exception) as e:
|
||||||
# Mnemonic is too short: 10 words instead of 11
|
# Mnemonic is too short: 10 words instead of 11
|
||||||
partial_mnemonic = "abandon " * 9 + "about"
|
partial_mnemonic = "abandon " * 9 + "about"
|
||||||
mnemonic_generation.calculate_checksum(partial_mnemonic.split(" "))
|
mnemonic_generation.calculate_checksum(partial_mnemonic)
|
||||||
assert "12- or 24-word" in str(e)
|
assert "12- or 24-word" in str(e)
|
||||||
|
|
||||||
with pytest.raises(Exception) as e:
|
with pytest.raises(Exception) as e:
|
||||||
# Valid mnemonic but unsupported length
|
# Valid mnemonic but unsupported length
|
||||||
mnemonic = "devote myth base logic dust horse nut collect buddy element eyebrow visit empty dress jungle"
|
mnemonic = "devote myth base logic dust horse nut collect buddy element eyebrow visit empty dress jungle"
|
||||||
mnemonic_generation.calculate_checksum(mnemonic.split(" "))
|
mnemonic_generation.calculate_checksum(mnemonic)
|
||||||
assert "12- or 24-word" in str(e)
|
assert "12- or 24-word" in str(e)
|
||||||
|
|
||||||
with pytest.raises(Exception) as e:
|
with pytest.raises(Exception) as e:
|
||||||
# Mnemonic is too short: 22 words instead of 23
|
# Mnemonic is too short: 22 words instead of 23
|
||||||
partial_mnemonic = "abandon " * 21 + "about"
|
partial_mnemonic = "abandon " * 21 + "about"
|
||||||
mnemonic_generation.calculate_checksum(partial_mnemonic.split(" "))
|
mnemonic_generation.calculate_checksum(partial_mnemonic)
|
||||||
assert "12- or 24-word" in str(e)
|
assert "12- or 24-word" in str(e)
|
||||||
|
|
||||||
with pytest.raises(ValueError) as e:
|
with pytest.raises(ValueError) as e:
|
||||||
# Invalid BIP-39 word
|
# Invalid BIP-39 word
|
||||||
partial_mnemonic = "foobar " * 11 + "about"
|
partial_mnemonic = "foobar " * 11 + "about"
|
||||||
mnemonic_generation.calculate_checksum(partial_mnemonic.split(" "))
|
mnemonic_generation.calculate_checksum(partial_mnemonic)
|
||||||
assert "not in the dictionary" in str(e)
|
assert "not in the dictionary" in str(e)
|
||||||
|
|
||||||
|
|
||||||
@@ -101,17 +101,17 @@ def test_calculate_checksum_with_default_final_word():
|
|||||||
the mnemonic.
|
the mnemonic.
|
||||||
"""
|
"""
|
||||||
partial_mnemonic = "crawl focus rescue cable view pledge rather dinner cousin unfair day"
|
partial_mnemonic = "crawl focus rescue cable view pledge rather dinner cousin unfair day"
|
||||||
mnemonic1 = mnemonic_generation.calculate_checksum(partial_mnemonic.split(" "))
|
mnemonic1 = mnemonic_generation.calculate_checksum(partial_mnemonic)
|
||||||
|
|
||||||
partial_mnemonic += " abandon"
|
partial_mnemonic += " abandon"
|
||||||
mnemonic2 = mnemonic_generation.calculate_checksum(partial_mnemonic.split(" "))
|
mnemonic2 = mnemonic_generation.calculate_checksum(partial_mnemonic)
|
||||||
assert mnemonic1 == mnemonic2
|
assert mnemonic1 == mnemonic2
|
||||||
|
|
||||||
partial_mnemonic = "bubble father debate ankle injury fence mesh evolve section wet coyote violin pyramid flower rent arrow round clutch myth safe base skin mobile"
|
partial_mnemonic = "bubble father debate ankle injury fence mesh evolve section wet coyote violin pyramid flower rent arrow round clutch myth safe base skin mobile"
|
||||||
mnemonic1 = mnemonic_generation.calculate_checksum(partial_mnemonic.split(" "))
|
mnemonic1 = mnemonic_generation.calculate_checksum(partial_mnemonic)
|
||||||
|
|
||||||
partial_mnemonic += " abandon"
|
partial_mnemonic += " abandon"
|
||||||
mnemonic2 = mnemonic_generation.calculate_checksum(partial_mnemonic.split(" "))
|
mnemonic2 = mnemonic_generation.calculate_checksum(partial_mnemonic)
|
||||||
assert mnemonic1 == mnemonic2
|
assert mnemonic1 == mnemonic2
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user