Example #1
0
def step_impl(context):
    buffer = io.BytesIO()
    context.backend.render(context.canvas, buffer)
    buffer.seek(0)

    image = testing.read_png(buffer)
    nose.tools.assert_equal(image.shape, (600, 600, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
Example #2
0
def step_impl(context):
    buffer = io.BytesIO()
    context.backend.render(context.canvas, buffer)
    buffer.seek(0)

    image = testing.read_png(buffer)
    nose.tools.assert_equal(image.shape, (600, 600, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
Example #3
0
def step_impl(context):
    png = context.backend.render(context.canvas, width="200px")
    image = testing.read_png(io.BytesIO(png))
    nose.tools.assert_equal(image.shape, (200, 200, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
Example #4
0
def step_impl(context):
    target = os.path.join(testing.backend_dir, "%s.png" % context.name)
    context.backend.render(context.canvas, target)
    image = testing.read_png(target)
    nose.tools.assert_equal(image.shape, (600, 600, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
Example #5
0
def step_impl(context):
    png = context.backend.render(context.canvas, scale=0.5)
    image = testing.read_png(io.BytesIO(png))
    nose.tools.assert_equal(image.shape, (300, 300, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
Example #6
0
def step_impl(context):
    png = context.backend.render(context.canvas, width="200px")
    image = testing.read_png(io.BytesIO(png))
    nose.tools.assert_equal(image.shape, (200, 200, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
Example #7
0
def step_impl(context):
    target = os.path.join(testing.backend_dir, "%s.png" % context.name)
    context.backend.render(context.canvas, target)
    image = testing.read_png(target)
    nose.tools.assert_equal(image.shape, (600, 600, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
Example #8
0
def step_impl(context):
    png = context.backend.render(context.canvas, scale=0.5)
    image = testing.read_png(io.BytesIO(png))
    nose.tools.assert_equal(image.shape, (300, 300, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
Example #9
0
def step_impl(context):
    context.image = testing.read_png(
        os.path.join(art_dir, "toyplot-8-RGBA.png"))
    nose.tools.assert_equal(context.image.shape, (256, 256, 4))
    nose.tools.assert_equal(context.image.dtype, "uint8")
Example #10
0
def step_impl(context):
    context.image = testing.read_png(os.path.join(art_dir, "toyplot-8-L.png"))
    nose.tools.assert_equal(context.image.shape, (256, 256, 1))
    nose.tools.assert_equal(context.image.dtype, "uint8")
    context.image = (context.image, toyplot.color.brewer.map("BlueRed"))
Example #11
0
def step_impl(context):
    context.image = testing.read_png(os.path.join(art_dir, "toyplot-8-L.png"))
    context.image = context.image > 128
    nose.tools.assert_equal(context.image.shape, (256, 256, 1))
    nose.tools.assert_equal(context.image.dtype, "bool")
Example #12
0
def step_impl(context):
    for frame in toyplot.png.render_frames(context.canvas):
        image = testing.read_png(io.BytesIO(frame))
        nose.tools.assert_equal(image.shape, (600, 600, 4))
        nose.tools.assert_equal(image.dtype, "uint8")