示例#1
0
文件: backends.py 项目: kmatt/toyplot
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")
示例#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")
示例#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")
示例#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")
示例#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")
示例#6
0
文件: backends.py 项目: kmatt/toyplot
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")
示例#7
0
文件: backends.py 项目: kmatt/toyplot
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")
示例#8
0
文件: backends.py 项目: kmatt/toyplot
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")
示例#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")
示例#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"))
示例#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")
示例#12
0
文件: video.py 项目: dahuget/toyplot
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")