コード例 #1
0
    def test_decode_raises_for_invalid_string(self):
        with pytest.raises(ValueError):
            base32.decode("Ü'+?")

        with pytest.raises(ValueError):
            base32.decode("IOU20D011ARS")
コード例 #2
0
 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')
コード例 #3
0
 def test_basic_decode(self):
     assert base32.decode("16j") == 1234
コード例 #4
0
 def test_decode_invalid_checksum(self):
     with pytest.raises(ValueError):
         assert base32.decode("16j44", checksum=True)
コード例 #5
0
 def test_decode_checksum(self):
     assert base32.decode("16j82", checksum=True) == 1234
コード例 #6
0
 def test_decode_0_padded_equivalent_to_non_0_padded(self):
     assert base32.decode('016j') == base32.decode('16j')