Exemple #1
0
    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())
Exemple #2
0
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()
Exemple #3
0
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()
Exemple #4
0
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()
Exemple #5
0
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()
Exemple #6
0
 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))
Exemple #7
0
 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))