File: test_util.py

package info (click to toggle)
python-localzone 0.9.8-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 228 kB
  • sloc: python: 521; makefile: 11
file content (28 lines) | stat: -rw-r--r-- 468 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pytest
from localzone.util import checksum

# Test vectors
WORD = "abcde"
CS16 = "c8f0"
CS32 = "f04fc729"
CS64 = "c8c6c527646362c6"


def test_checksum_16():
    cs = checksum(WORD, 16)
    assert cs == CS16


def test_checksum_32():
    cs = checksum(WORD)
    assert cs == CS32


def test_checksum_64():
    cs = checksum(WORD, 64)
    assert cs == CS64


def test_checksum_invalid_size():
    with pytest.raises(ValueError):
        cs = checksum(WORD, 128)