diff options
Diffstat (limited to 'silx/gui/plot/_utils/test')
-rw-r--r-- | silx/gui/plot/_utils/test/test_ticklayout.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/silx/gui/plot/_utils/test/test_ticklayout.py b/silx/gui/plot/_utils/test/test_ticklayout.py index 8c67620..927ffb6 100644 --- a/silx/gui/plot/_utils/test/test_ticklayout.py +++ b/silx/gui/plot/_utils/test/test_ticklayout.py @@ -27,12 +27,13 @@ from __future__ import absolute_import, division, unicode_literals __authors__ = ["T. Vincent"] __license__ = "MIT" -__date__ = "18/10/2016" +__date__ = "17/01/2018" import unittest +import numpy -from silx.test.utils import ParametricTestCase +from silx.utils.testutils import ParametricTestCase from silx.gui.plot._utils import ticklayout @@ -40,6 +41,19 @@ from silx.gui.plot._utils import ticklayout class TestTickLayout(ParametricTestCase): """Test ticks layout algorithms""" + def testTicks(self): + """Test of :func:`ticks`""" + tests = { # (vmin, vmax): ref_ticks + (1., 1.): (1.,), + (0.5, 10.5): (2.0, 4.0, 6.0, 8.0, 10.0), + (0.001, 0.005): (0.001, 0.002, 0.003, 0.004, 0.005) + } + + for (vmin, vmax), ref_ticks in tests.items(): + with self.subTest(vmin=vmin, vmax=vmax): + ticks, labels = ticklayout.ticks(vmin, vmax) + self.assertTrue(numpy.allclose(ticks, ref_ticks)) + def testNiceNumbers(self): """Minimalistic tests of :func:`niceNumbers`""" tests = { # (vmin, vmax): ref_ticks |