File: test_audioformat.py

package info (click to toggle)
python-av 16.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,684 kB
  • sloc: python: 7,607; sh: 182; ansic: 174; makefile: 135
file content (28 lines) | stat: -rw-r--r-- 638 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
26
27
28
import sys

import pytest

from av import AudioFormat


def test_s16_inspection() -> None:
    fmt = AudioFormat("s16")
    postfix = "le" if sys.byteorder == "little" else "be"

    assert fmt.name == "s16"
    assert not fmt.is_planar
    assert fmt.bits == 16
    assert fmt.bytes == 2
    assert fmt.container_name == "s16" + postfix
    assert fmt.planar.name == "s16p"
    assert fmt.packed is fmt


def test_s32p_inspection() -> None:
    fmt = AudioFormat("s32p")
    assert fmt.name == "s32p"
    assert fmt.is_planar
    assert fmt.bits == 32
    assert fmt.bytes == 4

    pytest.raises(ValueError, lambda: fmt.container_name)