Exemple #1
0
    def test_encode_number(self):
        assert base32.encode(0) == "0"

        with pytest.raises(ValueError):
            base32.encode(-1)
Exemple #2
0
 def test_encode_checksum(self):
     assert base32.encode(1234, checksum=True) == "16j82"
Exemple #3
0
    def test_encode_hyphenates(self):
        assert base32.encode(1234, split_every=1) == "1-6-j"

        with pytest.raises(ValueError):
            assert base32.encode(1234, split_every=-1)
Exemple #4
0
 def test_encode_min_length(self):
     assert base32.encode(1234, min_length=4) == "016j"
     assert base32.encode(1234, min_length=2) == "16j"
     assert base32.encode(1234, min_length=0) == "16j"
     assert base32.encode(1234, min_length=-1) == "16j"
Exemple #5
0
 def test_basic_encode(self):
     assert base32.encode(32) == "10"
     assert base32.encode(1234) == "16j"