Ejemplo n.º 1
0
def test_Plotter_plot(source, image_mock):
    ex = ons.Extent(1100, 1900, 4200, 5500)
    plotter = ons.Plotter(ex, source)
    ax = mock.Mock()
    plotter.plot(ax, bob="fish")

    assert source.call_args_list == [
        mock.call("SV 1000 4000"), mock.call("SV 1000 5000") ]
    assert ax.imshow.call_args_list == [
        mock.call(image_mock.new.return_value, interpolation="lanczos", extent=(1000, 2000, 4000, 6000), bob="fish"),
        ]
Ejemplo n.º 2
0
def test_Plotter_ignore_errors(source, image_mock):
    source.side_effect = Exception
    ex = ons.Extent(1100, 1900, 4200, 5500)
    plotter = ons.Plotter(ex, source)
    ax = mock.Mock()
    plotter.plotlq(ax, bob="fish")

    assert ax.imshow.call_args_list == [
        mock.call(source.blank.return_value, interpolation="lanczos", extent=(1000, 2000, 4000, 5000), bob="fish"),
        mock.call(source.blank.return_value, interpolation="lanczos", extent=(1000, 2000, 5000, 6000), bob="fish")
        ]
Ejemplo n.º 3
0
def test_Plotter_as_one_image(source, image_mock):
    ex = ons.Extent(1100, 1900, 4200, 5500)
    plotter = ons.Plotter(ex, source)
    ax = mock.Mock()
    out = plotter.as_one_image()

    assert source.call_args_list == [
        mock.call("SV 1000 4000"), mock.call("SV 1000 5000") ]
    image_mock.new.assert_called_with("RGB", (2000, 4000))
    im = image_mock.new.return_value
    assert out is im
    assert im.paste.call_args_list == [
        mock.call(source.return_value, (0, 2000)),
        mock.call(source.return_value, (0, 0))
        ]