-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make tests more idiomatic for pytest
We don't need to put tests in a class anymore. I also sprinkled some type hints here and there. Left a few because the commit would be too big otherwise.
- Loading branch information
Showing
18 changed files
with
1,723 additions
and
1,719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
import sys | ||
|
||
import pytest | ||
|
||
from av import AudioFormat | ||
|
||
from .common import TestCase | ||
|
||
postfix = "le" if sys.byteorder == "little" else "be" | ||
|
||
|
||
class TestAudioFormats(TestCase): | ||
def test_s16_inspection(self) -> None: | ||
fmt = AudioFormat("s16") | ||
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(self) -> None: | ||
fmt = AudioFormat("s32p") | ||
assert fmt.name == "s32p" | ||
assert fmt.is_planar | ||
assert fmt.bits == 32 | ||
assert fmt.bytes == 4 | ||
self.assertRaises(ValueError, lambda: fmt.container_name) | ||
|
||
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) |
Oops, something went wrong.