5
from numpy.testing.utils import assert_almost_equal
6
from enthought.chaco2.shell.plot_maker import make_data_sources
8
class MakeDataSourcesTestCase(unittest.TestCase):
10
def test_1D_single(self):
12
ary = np.array([3.0, 2.1, 1.3, 1.8, 5.7])
13
sources = make_data_sources(session, "none", ary)
14
assert_almost_equal(sources[0][0].get_data(), np.arange(len(ary)))
15
assert_almost_equal(sources[0][1].get_data(), ary)
18
def test_1d_multiple(self):
20
index = np.arange(-np.pi, np.pi, np.pi/30.0)
24
sources = make_data_sources(session, "ascending", index, s, c, t)
25
assert_almost_equal(sources[0][0].get_data(), index)
26
self.assert_(sources[0][0] == sources[1][0])
27
self.assert_(sources[0][0] == sources[2][0])
28
assert_almost_equal(sources[0][1].get_data(), s)
29
assert_almost_equal(sources[1][1].get_data(), c)
30
assert_almost_equal(sources[2][1].get_data(), t)
34
if __name__ == "__main__":