-
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.
Replace self.assertEqual with
assert
statement
Works better with mypy. `assert`s work equally well since we're using pytest now.
- Loading branch information
Showing
11 changed files
with
205 additions
and
221 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
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,40 +1,38 @@ | ||
import av | ||
from av.video.reformatter import ColorRange, Colorspace | ||
|
||
from .common import TestCase, fate_suite | ||
from .common import fate_suite | ||
|
||
|
||
class TestColorSpace(TestCase): | ||
class TestColorSpace: | ||
def test_penguin_joke(self) -> None: | ||
container = av.open( | ||
fate_suite("amv/MTV_high_res_320x240_sample_Penguin_Joke_MTV_from_WMV.amv") | ||
) | ||
stream = container.streams.video[0] | ||
|
||
self.assertEqual(stream.codec_context.color_range, 2) | ||
self.assertEqual(stream.codec_context.color_range, ColorRange.JPEG) | ||
assert stream.codec_context.color_range == 2 | ||
assert stream.codec_context.color_range == ColorRange.JPEG | ||
|
||
self.assertEqual(stream.codec_context.color_primaries, 2) | ||
self.assertEqual(stream.codec_context.color_trc, 2) | ||
assert stream.codec_context.color_primaries == 2 | ||
assert stream.codec_context.color_trc == 2 | ||
|
||
self.assertEqual(stream.codec_context.colorspace, 5) | ||
self.assertEqual(stream.codec_context.colorspace, Colorspace.ITU601) | ||
assert stream.codec_context.colorspace == 5 | ||
assert stream.codec_context.colorspace == Colorspace.ITU601 | ||
|
||
for packet in container.demux(stream): | ||
for frame in packet.decode(): | ||
assert isinstance(frame, av.VideoFrame) | ||
self.assertEqual(frame.color_range, ColorRange.JPEG) # a.k.a "pc" | ||
self.assertEqual(frame.colorspace, Colorspace.ITU601) | ||
return | ||
for frame in container.decode(stream): | ||
assert frame.color_range == ColorRange.JPEG # a.k.a "pc" | ||
assert frame.colorspace == Colorspace.ITU601 | ||
return | ||
|
||
def test_sky_timelapse(self) -> None: | ||
container = av.open( | ||
av.datasets.curated("pexels/time-lapse-video-of-night-sky-857195.mp4") | ||
) | ||
stream = container.streams.video[0] | ||
|
||
self.assertEqual(stream.codec_context.color_range, 1) | ||
self.assertEqual(stream.codec_context.color_range, ColorRange.MPEG) | ||
self.assertEqual(stream.codec_context.color_primaries, 1) | ||
self.assertEqual(stream.codec_context.color_trc, 1) | ||
self.assertEqual(stream.codec_context.colorspace, 1) | ||
assert stream.codec_context.color_range == 1 | ||
assert stream.codec_context.color_range == ColorRange.MPEG | ||
assert stream.codec_context.color_primaries == 1 | ||
assert stream.codec_context.color_trc == 1 | ||
assert stream.codec_context.colorspace == 1 |
Oops, something went wrong.