FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Test bad stream selectors · harrison18/ffmpeg-python@1e63419 · GitHub

Repository navigation

Commit 1e63419

Browse files
committed
Test bad stream selectors
1 parent 57abf6e commit 1e63419

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

‎ffmpeg/nodes.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ def __getitem__(self, index):
5252
5353
Process the audio and video portions of a stream independently::
5454
55-
in = ffmpeg.input('in.mp4')
56-
audio = in['a'].filter_("aecho", 0.8, 0.9, 1000, 0.3)
57-
video = in['v'].hflip()
58-
ffmpeg.output(audio, video, 'out.mp4')
55+
input = ffmpeg.input('in.mp4')
56+
audio = input['a'].filter_("aecho", 0.8, 0.9, 1000, 0.3)
57+
video = input['v'].hflip()
58+
out = ffmpeg.output(audio, video, 'out.mp4')
5959
"""
6060
if self.selector is not None:
6161
raise ValueError('Stream already has a selector: {}'.format(self))
6262
elif not isinstance(index, basestring):
63-
raise TypeError("Expected string index (e.g. 'v'); got {!r}".format(index))
63+
raise TypeError("Expected string index (e.g. 'a'); got {!r}".format(index))
6464
return self.node.stream(label=self.label, selector=index)
6565

6666

‎ffmpeg/tests/test_ffmpeg.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,22 @@ def test_filter_with_selector():
175175
]
176176

177177

178+
def test_filter_with_bad_selectors():
179+
input = ffmpeg.input(TEST_INPUT_FILE1)
180+
181+
with pytest.raises(ValueError) as excinfo:
182+
input['a']['a']
183+
assert str(excinfo.value).startswith('Stream already has a selector:')
184+
185+
with pytest.raises(TypeError) as excinfo:
186+
input[:'a']
187+
assert str(excinfo.value).startswith("Expected string index (e.g. 'a')")
188+
189+
with pytest.raises(TypeError) as excinfo:
190+
input[5]
191+
assert str(excinfo.value).startswith("Expected string index (e.g. 'a')")
192+
193+
178194
def _get_complex_filter_asplit_example():
179195
split = (ffmpeg
180196
.input(TEST_INPUT_FILE1)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL