def test_time_scale_with_formatter(self): """ Regression test for TimeScale() with formatter keyword. Using the formatter keyword in the constructor of TimeScale could raise a KeyError. This test passes if no exception is raised. """ ts = TimeScale(seconds=1, formatter=TimeFormatter()) ts = TimeScale(minutes=1, formatter=TimeFormatter())
def test_time_scale_milliseconds_01(): ts = TimeScale(milliseconds=1) ticks = ts.ticks(0, 0.1) assert len(ticks) == 11 assert (np.array(ticks) == np.linspace(0.0, 0.1, 11)).all()
def test_time_scale_seconds_02(): ts = TimeScale(seconds=2) ticks = ts.ticks(0, 10) assert (np.array(ticks) == np.linspace(0.0, 10.0, 6)).all()
def test_time_scale_milliseconds_01(self): ts = TimeScale(milliseconds=1) ticks = ts.ticks(0, 0.1) self.assertEqual(len(ticks), 11) nptest.assert_array_equal(np.array(ticks), np.linspace(0.0, 0.1, 11))
def test_time_scale_seconds_02(self): ts = TimeScale(seconds=2) ticks = ts.ticks(0, 10) nptest.assert_array_equal(np.array(ticks), np.linspace(0.0, 10.0, 6))