File: test_inputvalidation.py

package info (click to toggle)
python-sabyenc 5.4.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 39,044 kB
  • sloc: cpp: 12,297; sh: 1,121; python: 652; ansic: 191; makefile: 13
file content (34 lines) | stat: -rw-r--r-- 910 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
29
30
31
32
33
34
import pytest
import sys
import sabyenc3
from tests.testsupport import *


def test_simd_version():
    # Windows and macOS systems always have some form of SIMD
    if sys.platform == "darwin" or sys.platform == "win32":
        assert sabyenc3.simd


def test_list_none():
    with pytest.raises(TypeError) as excinfo:
        sabyenc3.decode_usenet_chunks(None)
    assert "Expected list" in str(excinfo.value)


def test_list_str():
    with pytest.raises(TypeError) as excinfo:
        sabyenc3.decode_usenet_chunks("baddata")
    assert "Expected list" in str(excinfo.value)


def test_list_int():
    with pytest.raises(TypeError) as excinfo:
        sabyenc3.decode_usenet_chunks(1)
    assert "Expected list" in str(excinfo.value)


def test_list_dict():
    with pytest.raises(TypeError) as excinfo:
        sabyenc3.decode_usenet_chunks({1: "yenc"})
    assert "Expected list" in str(excinfo.value)