File: test_ots.py

package info (click to toggle)
python-opentype-sanitizer 8.1.3.post1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 160 kB
  • sloc: python: 329; sh: 18; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 607 bytes parent folder | download | duplicates (2)
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
from __future__ import absolute_import, unicode_literals
import pytest
import subprocess
import ots


def test_sanitize():
    p = ots.sanitize()
    assert p.returncode == 1
    assert len(p.args) == 1
    assert p.args[0].endswith("ots-sanitize")
    assert p.stdout == None
    assert p.stderr == None


def test_check_error():
    with pytest.raises(subprocess.CalledProcessError):
        ots.sanitize("--foo", "bar", check=True)


def test_capture_output():
    p = ots.sanitize(capture_output=True)
    assert len(p.stdout) == 0
    stderr = p.stderr.decode()
    assert stderr.startswith("Usage: ")