def test_decode_raises_for_invalid_string(self): with pytest.raises(ValueError): base32.decode("Ü'+?") with pytest.raises(ValueError): base32.decode("IOU20D011ARS")
def test_decode_normalizes_symbols(self): assert (base32.decode("abcdefghijklmnopqrstvwxyz") == base32.decode( "ABCDEFGHIJKLMNOPQRSTVWXYZ")) assert base32.decode('IL1O0ilo') == base32.decode('11100110') assert base32.decode('1-6-j') == base32.decode('16j')
def test_basic_decode(self): assert base32.decode("16j") == 1234
def test_decode_invalid_checksum(self): with pytest.raises(ValueError): assert base32.decode("16j44", checksum=True)
def test_decode_checksum(self): assert base32.decode("16j82", checksum=True) == 1234
def test_decode_0_padded_equivalent_to_non_0_padded(self): assert base32.decode('016j') == base32.decode('16j')