Пример #1
0
def step_impl(context):
    testing.assert_color_equal(context.color_map.color(-1),
                               [0.23003265, 0.29899933, 0.75400176, 1.])
    testing.assert_color_equal(context.color_map.color(0),
                               [0.23003265, 0.29899933, 0.75400176, 1.])
    testing.assert_color_equal(context.color_map.color(0.5),
                               [0.86539042, 0.86541865, 0.86532601, 1.])
    testing.assert_color_equal(context.color_map.color(1),
                               [0.7059977, 0.01612647, 0.15000112, 1.])
    testing.assert_color_equal(context.color_map.color(2),
                               [0.7059977, 0.01612647, 0.15000112, 1.])
Пример #2
0
def step_impl(context):
    testing.assert_color_equal(
        context.color_map.color(-1), (1, 0, 0, 1))
    testing.assert_color_equal(
        context.color_map.color(0), (1, 0, 0, 1))
    testing.assert_color_equal(
        context.color_map.color(0.5), (0.5, 0, 0.5, 1))
    testing.assert_color_equal(
        context.color_map.color(1), (0, 0, 1, 1))
    testing.assert_color_equal(
        context.color_map.color(2), (0, 0, 1, 1))
Пример #3
0
def step_impl(context):
    testing.assert_color_equal(
        context.color_map.color(-1), [0.23003265,  0.29899933,  0.75400176,  1.])
    testing.assert_color_equal(
        context.color_map.color(0), [0.23003265,  0.29899933,  0.75400176,  1.])
    testing.assert_color_equal(
        context.color_map.color(0.5), [0.86539042,  0.86541865,  0.86532601,  1.])
    testing.assert_color_equal(
        context.color_map.color(1), [0.7059977,  0.01612647,  0.15000112,  1.])
    testing.assert_color_equal(
        context.color_map.color(2), [0.7059977,  0.01612647,  0.15000112,  1.])
Пример #4
0
def step_impl(context):
    palette = toyplot.color.Palette([(1, 0, 0), (0, 1, 0), (0, 0, 1)])
    color = iter(palette)
    testing.assert_color_equal(next(color), (1, 0, 0, 1))
    testing.assert_color_equal(next(color), (0, 1, 0, 1))
    testing.assert_color_equal(next(color), (0, 0, 1, 1))
    with nose.tools.assert_raises(StopIteration):
        next(color)
Пример #5
0
def step_impl(context):
    palette = toyplot.color.Palette([(1, 0, 0), (0, 1, 0), (0, 0, 1)])
    color = iter(palette)
    testing.assert_color_equal(next(color), (1, 0, 0, 1))
    testing.assert_color_equal(next(color), (0, 1, 0, 1))
    testing.assert_color_equal(next(color), (0, 0, 1, 1))
    with nose.tools.assert_raises(StopIteration):
        next(color)
Пример #6
0
def step_impl(context):
    palette = toyplot.color.Palette([(1, 0, 0), (0, 1, 0), (0, 0, 1)])
    testing.assert_color_equal(palette[0], (1, 0, 0, 1))
    testing.assert_color_equal(palette[1], (0, 1, 0, 1))
    testing.assert_color_equal(palette[-1], (0, 0, 1, 1))
    with nose.tools.assert_raises(IndexError):
        palette[3]
    with nose.tools.assert_raises(TypeError):
        palette[0:3]
Пример #7
0
def step_impl(context):
    palette = toyplot.color.Palette([(1, 0, 0), (0, 1, 0), (0, 0, 1)])
    testing.assert_color_equal(palette[0], (1, 0, 0, 1))
    testing.assert_color_equal(palette[1], (0, 1, 0, 1))
    testing.assert_color_equal(palette[-1], (0, 0, 1, 1))
    with nose.tools.assert_raises(IndexError):
        palette[3]
    with nose.tools.assert_raises(TypeError):
        palette[0:3]
Пример #8
0
def step_impl(context):
    colormap = toyplot.color.CategoricalMap(
        toyplot.color.Palette(["red", "lime", "blue", (1, 1, 1)]))
    testing.assert_color_equal(colormap.color(0), (1, 0, 0, 1))
    testing.assert_color_equal(colormap.color(-1), (1, 1, 1, 1))
Пример #9
0
def step_impl(context):
    palette = toyplot.color.Palette([(1, 0, 0), (0, 1, 0), (0, 0, 1)])
    testing.assert_color_equal(palette.color(0), (1, 0, 0, 1))
    testing.assert_color_equal(palette.color(-1), (0, 0, 1, 1))
Пример #10
0
def step_impl(context):
    testing.assert_color_equal(context.color_map.color(-1), (1, 0, 0, 1))
    testing.assert_color_equal(context.color_map.color(0), (1, 0, 0, 1))
    testing.assert_color_equal(context.color_map.color(0.5), (0.5, 0, 0.5, 1))
    testing.assert_color_equal(context.color_map.color(1), (0, 0, 1, 1))
    testing.assert_color_equal(context.color_map.color(2), (0, 0, 1, 1))
Пример #11
0
def step_impl(context, value):
    testing.assert_color_equal(toyplot.color.css(context.value), eval(value))
Пример #12
0
def step_impl(context):
    colormap = toyplot.color.CategoricalMap(
        toyplot.color.Palette(["red", "lime", "blue", (1, 1, 1)]))
    testing.assert_color_equal(colormap.color(0), (1, 0, 0, 1))
    testing.assert_color_equal(colormap.color(-1), (1, 1, 1, 1))
Пример #13
0
def step_impl(context):
    palette = toyplot.color.Palette([(1, 0, 0), (0, 1, 0), (0, 0, 1)])
    testing.assert_color_equal(palette.color(0), (1, 0, 0, 1))
    testing.assert_color_equal(palette.color(-1), (0, 0, 1, 1))
Пример #14
0
def step_impl(context, value):
    testing.assert_color_equal(
        toyplot.color.css(context.value), eval(value))