/usr/lib/python2.7/dist-packages/chaco/tests/scatterplot_renderers_test_case.py is in python-chaco 4.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | import unittest
from numpy import alltrue
from enable.compiled_path import CompiledPath
# Chaco imports
from chaco.api import create_scatter_plot, PlotGraphicsContext
class DrawScatterplotCase(unittest.TestCase):
def test_scatter_fast(self):
""" Coverage test to check basic case works """
size = (50, 50)
scatterplot = create_scatter_plot(
data=[range(10), range(10)],
border_visible=False,
)
scatterplot.outer_bounds = list(size)
gc = PlotGraphicsContext(size)
gc.render_component(scatterplot)
actual = gc.bmp_array[:, :, :]
self.assertFalse(alltrue(actual == 255))
def test_scatter_circle(self):
""" Coverage test to check circles work """
size = (50, 50)
scatterplot = create_scatter_plot(
data=[range(10), range(10)],
marker="circle",
border_visible=False,
)
scatterplot.outer_bounds = list(size)
gc = PlotGraphicsContext(size)
gc.render_component(scatterplot)
actual = gc.bmp_array[:, :, :]
self.assertFalse(alltrue(actual == 255))
def test_scatter_custom(self):
""" Coverage test to check custom markers work """
# build path
path = CompiledPath()
path.move_to(-5, -5)
path.line_to(5, 5)
path.line_to(5, -5)
path.line_to(-5, 5)
path.line_to(-5, -5)
size = (50, 50)
scatterplot = create_scatter_plot(
data=[range(10), range(10)],
marker='custom',
border_visible=False,
)
scatterplot.custom_symbol = path
scatterplot.outer_bounds = list(size)
gc = PlotGraphicsContext(size)
gc.render_component(scatterplot)
actual = gc.bmp_array[:, :, :]
self.assertFalse(alltrue(actual == 255))
def test_scatter_slow(self):
""" Coverage test to check multiple marker size works """
size = (50, 50)
scatterplot = create_scatter_plot(
data=[range(10), range(10)],
border_visible=False,
marker_size=range(1, 11),
)
scatterplot.outer_bounds = list(size)
gc = PlotGraphicsContext(size)
gc.render_component(scatterplot)
actual = gc.bmp_array[:, :, :]
self.assertFalse(alltrue(actual == 255))
if __name__ == "__main__":
unittest.main()
|