Beispiel #1
0
 def test_default(self):
     """Ensure default property is mapping properly."""
     test = StreamLabel()
     assert test.default == ''
     test.default = True
     assert test.default == 'default'
     test.default = False
     assert test.default == ''
Beispiel #2
0
 def test_minimal(self):
     """Ensure that an empty StreamLabel instance has empty string attrs."""
     empty = StreamLabel()
     attrs = [
         'title', 'bitrate', 'resolution', 'language', 'channels', 'default'
     ]
     for attr in attrs:
         assert getattr(empty, attr) == ''
Beispiel #3
0
 def test_minimal(self):
     """Ensure that optional and instance  Stream attrs are properly
     instantiated."""
     built = Stream(2, 'audio', 'mp3')
     attrs = {
         'custom_crf': None,
         'custom_bitrate': None,
         'option_summary': None,
         'labels': StreamLabel()
     }
     for attr, value in attrs.items():
         assert getattr(built, attr) == value
Beispiel #4
0
 def test_audio_labels_bitrate(self):
     """Ensure that audio options are properly generated when using the
     labels bitrate."""
     bitrate = 256
     labels = StreamLabel(bitrate=bitrate)
     built = Stream(2, 'audio', FAKE_CODEC, labels=labels)
     assert built.build_options() == [
         '-c:a:0', defaults.C_AUDIO, '-b:a:0',
         str(bitrate) + 'k'
     ]
     assert built.option_summary == (
         'transcode -> {}, bitrate={}Kib/s'.format(defaults.C_AUDIO,
                                                   bitrate))
Beispiel #5
0
def example_sub_streamlabel():
    """Return an example StreamLabel which should match the subtitle stream
    from example.json."""
    return StreamLabel('Example Subtitle Stream', '', '', 'spa', '', False)
Beispiel #6
0
def example_video_streamlabel():
    """Return an example StreamLabel which should match the video stream from
    example.json."""
    return StreamLabel('Example Video Stream', 11.44, '214x160', 'eng', '',
                       True)
Beispiel #7
0
def other_audio_streamlabel():
    """Return an example StreamLabel which should match the non-default audio
    stream from example.json."""
    return StreamLabel('Example Audio Stream', 500, '', 'spa', '5.1', False)
Beispiel #8
0
def example_audio_streamlabel():
    """Return an example StreamLabel which should match the default audio
    stream from example.json."""
    return StreamLabel('Example Audio Stream', 250, '', 'eng', 'stereo', True)
Beispiel #9
0
 def test_match_example_sub(self, example_sub_streamlabel):
     """Ensure that the example subtitle instance matches one built from
     example.json."""
     built = StreamLabel.from_dict(EXAMPLE['streams'][3])
     assert example_sub_streamlabel == built
Beispiel #10
0
 def test_match_example_video(self, example_video_streamlabel):
     """Ensure that the example audio instance matches one built from
     example.json."""
     built = StreamLabel.from_dict(EXAMPLE['streams'][0])
     assert example_video_streamlabel == built