예제 #1
0
def test_export_video_avi_colour(exists, pipe):
    exists.return_value = False
    fake_path = Path('/fake/fake.avi')
    mio.export_video([colour_test_img, colour_test_img], fake_path,
                     extension='avi')
    assert pipe.return_value.stdin.write.call_count == 2
    assert 'rgb24' in pipe.call_args[0][0]
예제 #2
0
def test_export_video_avi_shape_mismatch(exists, pipe):
    exists.return_value = False
    fake_path = Path('/fake/fake.avi')
    with warnings.catch_warnings(record=True) as w:
        warnings.simplefilter("always")
        mio.export_video([test_img.resize([150, 100]), test_img], fake_path,
                         extension='avi')
        assert len(w) == 1
    assert 'gray8' in pipe.call_args[0][0]
예제 #3
0
def test_export_video_avi_gray_first_mixed(exists, pipe):
    exists.return_value = False
    fake_path = Path('/fake/fake.avi')
    with warnings.catch_warnings(record=True) as w:
        warnings.simplefilter("always")
        mio.export_video([test_img, colour_test_img], fake_path,
                         extension='avi')
        assert len(w) == 1
    assert pipe.return_value.stdin.write.call_count == 2
    assert 'gray8' in pipe.call_args[0][0]
예제 #4
0
def test_export_video_avi_colour_first_mixed(exists, pipe):
    exists.return_value = False
    fake_path = Path("/fake/fake.avi")
    mio.export_video([colour_test_img, test_img], fake_path, extension="avi")
    assert pipe.return_value.stdin.write.call_count == 2
    recon_0 = pipe.return_value.stdin.write.mock_calls[0][1][0]
    assert np.frombuffer(recon_0, dtype=np.uint8).size == 30000
    # Ensure that the second frame is converted to gray
    recon_1 = pipe.return_value.stdin.write.mock_calls[1][1][0]
    assert np.frombuffer(recon_1, dtype=np.uint8).size == 30000
    assert "rgb24" in pipe.call_args[0][0]
예제 #5
0
def test_export_video_avi_gray_first_mixed(exists, pipe):
    exists.return_value = False
    fake_path = Path("/fake/fake.avi")
    with warnings.catch_warnings(record=True) as w:
        warnings.simplefilter("always")
        mio.export_video([test_img, colour_test_img],
                         fake_path,
                         extension="avi")
        assert len(w) == 1
    assert pipe.return_value.stdin.write.call_count == 2
    assert "gray8" in pipe.call_args[0][0]
예제 #6
0
def test_export_video_avi_colour_first_mixed(exists, pipe):
    exists.return_value = False
    fake_path = Path('/fake/fake.avi')
    mio.export_video([colour_test_img, test_img], fake_path,
                     extension='avi')
    assert pipe.return_value.stdin.write.call_count == 2
    recon_0 = pipe.return_value.stdin.write.mock_calls[0][1][0]
    assert np.fromstring(recon_0, dtype=np.uint8).size == 30000
    # Ensure that the second frame is converted to gray
    recon_1 = pipe.return_value.stdin.write.mock_calls[1][1][0]
    assert np.fromstring(recon_1, dtype=np.uint8).size == 30000
    assert 'rgb24' in pipe.call_args[0][0]
예제 #7
0
def test_export_video_gif(exists, pipe):
    exists.return_value = False
    fake_path = Path('/fake/fake.gif')
    mio.export_video([test_img, test_img], fake_path, extension='gif')
    assert pipe.return_value.stdin.write.call_count == 2
예제 #8
0
def test_export_video_avi_gray(exists, pipe):
    exists.return_value = False
    fake_path = Path('/fake/fake.avi')
    mio.export_video([test_img, test_img], fake_path, extension='avi')
    assert pipe.return_value.stdin.write.call_count == 2
    assert 'gray8' in pipe.call_args[0][0]
예제 #9
0
def test_export_video_avi_kwargs(exists, pipe):
    exists.return_value = False
    fake_path = Path('/fake/fake.avi')
    mio.export_video([test_img, test_img], fake_path, extension='avi', **{'crf' : '0'})
    assert pipe.return_value.stdin.write.call_count == 2
    assert '-crf' in pipe.call_args[0][0]
예제 #10
0
def test_export_video_gif(exists, pipe):
    exists.return_value = False
    fake_path = Path('/fake/fake.gif')
    mio.export_video([test_img, test_img], fake_path, extension='gif')
    assert pipe.return_value.stdin.write.call_count == 2
예제 #11
0
def test_export_video_gif(exists, fake_writer):
    exists.return_value = False
    fake_path = Path('/fake/fake.gif')
    mio.export_video([test_img, test_img], fake_path, extension='gif')
    assert fake_writer.return_value.append_data.call_count == 2
예제 #12
0
def test_export_video_gif(exists, fake_writer):
    exists.return_value = False
    fake_path = Path('/fake/fake.gif')
    mio.export_video([test_img, test_img], fake_path, extension='gif')
    assert fake_writer.return_value.append_data.call_count == 2