/usr/lib/python2.7/dist-packages/chaco/tools/tests/pan_tool_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 | import unittest
import numpy as np
from chaco.array_plot_data import ArrayPlotData
from chaco.plot import Plot
from chaco.tools.pan_tool import PanTool
from enable.testing import EnableTestAssistant
class PanToolTestCase(EnableTestAssistant, unittest.TestCase):
def test_restrict_to_data_with_empty_source(self):
# Regression test for #214.
plot_data = ArrayPlotData()
plot = Plot(plot_data)
arr = np.arange(4.0)
plot_data.set_data("x", arr)
plot_data.set_data("y", arr)
plot_data.set_data("z", np.array([], np.float64))
plot.plot(('x', 'y'))
plot.plot(('z', 'z'))
tool = PanTool(plot, restrict_to_data=True)
plot.tools.append(tool)
x_range = plot.x_mapper.range
y_range = plot.y_mapper.range
x_bounds = (x_range.low, x_range.high)
y_bounds = (y_range.low, y_range.high)
self.mouse_down(tool, 0.0, 0.0)
self.mouse_move(interactor=tool, x=1.0, y=1.0)
self.mouse_up(interactor=tool, x=1.0, y=1.0)
self.assertEqual((x_range.low, x_range.high), x_bounds)
self.assertEqual((y_range.low, y_range.high), y_bounds)
if __name__ == '__main__':
import nose
nose.run()
|