コード例 #1
0
 def test_find_x_times_DAY(self):
     (dt_out, delta_out) = glyph.find_x_times(self.dt, glyph.DAY, 1)
     expected_dt = self.datetime(self.dt.year, self.dt.month,
                                 self.dt.day+1, 0, 0)
     expected_delta = self.timedelta(1)
     self.assertEqual(dt_out, expected_dt)
     self.assertEqual(delta_out, expected_delta)
コード例 #2
0
 def test_find_x_times_DAY(self):
     (dt_out, delta_out) = glyph.find_x_times(self.dt, glyph.DAY, 1)
     expected_dt = self.datetime(self.dt.year, self.dt.month,
                                 self.dt.day + 1, 0, 0)
     expected_delta = self.timedelta(1)
     self.assertEqual(dt_out, expected_dt)
     self.assertEqual(delta_out, expected_delta)
コード例 #3
0
 def test_find_x_times_HOUR(self):
     (dt_out, delta_out) = glyph.find_x_times(self.dt, glyph.HOUR, 1)
     expected_dt = self.datetime(self.dt.year, self.dt.month,
                                 self.dt.day, self.dt.hour+1, 0)
     expected_delta = self.timedelta(0, 3600)
     self.assertEqual(dt_out, expected_dt)
     self.assertEqual(delta_out, expected_delta)
コード例 #4
0
 def test_find_x_times_HOUR(self):
     (dt_out, delta_out) = glyph.find_x_times(self.dt, glyph.HOUR, 1)
     expected_dt = self.datetime(self.dt.year, self.dt.month, self.dt.day,
                                 self.dt.hour + 1, 0)
     expected_delta = self.timedelta(0, 3600)
     self.assertEqual(dt_out, expected_dt)
     self.assertEqual(delta_out, expected_delta)
コード例 #5
0
 def test_find_x_times_MIN(self):
     (dt_out, delta_out) = glyph.find_x_times(self.dt, glyph.MIN, 1)
     expected_dt = self.datetime(self.dt.year, self.dt.month, self.dt.day,
                                 self.dt.hour, self.dt.minute + 1)
     expected_delta = self.timedelta(0, 60)
     self.assertEqual(dt_out, expected_dt)
     self.assertEqual(delta_out, expected_delta)
コード例 #6
0
 def test_find_x_times_MIN(self):
     (dt_out, delta_out) = glyph.find_x_times(self.dt, glyph.MIN, 1)
     expected_dt = self.datetime(self.dt.year, self.dt.month,
                                 self.dt.day, self.dt.hour,
                                 self.dt.minute+1)
     expected_delta = self.timedelta(0, 60)
     self.assertEqual(dt_out, expected_dt)
     self.assertEqual(delta_out, expected_delta)
コード例 #7
0
 def test_find_x_times_SEC(self):
     (dt_out, delta_out) = glyph.find_x_times(self.dt, glyph.SEC, 1)
     expected_dt = self.datetime(self.dt.year, self.dt.month,
                                 self.dt.day, self.dt.hour,
                                 self.dt.minute, self.dt.second)
     expected_delta = self.timedelta(0, 1)
     self.assertEqual(dt_out, expected_dt)
     self.assertEqual(delta_out, expected_delta)
コード例 #8
0
 def test_find_x_times_SEC(self):
     (dt_out, delta_out) = glyph.find_x_times(self.dt, glyph.SEC, 1)
     expected_dt = self.datetime(self.dt.year, self.dt.month, self.dt.day,
                                 self.dt.hour, self.dt.minute,
                                 self.dt.second)
     expected_delta = self.timedelta(0, 1)
     self.assertEqual(dt_out, expected_dt)
     self.assertEqual(delta_out, expected_delta)
コード例 #9
0
 def test_find_x_times_xconfigs(self):
     for xconf in glyph.xAxisConfigs:
         glyph.find_x_times(self.dt, xconf['labelUnit'], xconf['labelStep'])
         glyph.find_x_times(self.dt, xconf['majorGridUnit'],
                            xconf['majorGridStep'])
         glyph.find_x_times(self.dt, xconf['minorGridUnit'],
                            xconf['minorGridStep'])
コード例 #10
0
 def test_find_x_times_xconfigs(self):
     for xconf in glyph.xAxisConfigs:
         glyph.find_x_times(self.dt, xconf['labelUnit'],
                            xconf['labelStep'])
         glyph.find_x_times(self.dt, xconf['majorGridUnit'],
                            xconf['majorGridStep'])
         glyph.find_x_times(self.dt, xconf['minorGridUnit'],
                            xconf['minorGridStep'])
コード例 #11
0
    def test_find_x_times_invalid_input(self):
        with self.assertRaises(ValueError):
            glyph.find_x_times(None, glyph.SEC, 1.0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, None, 1.0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.SEC, None)

        with self.assertRaises(ValueError):
            glyph.find_x_times('', glyph.SEC, 1.0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, '', 1.0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.SEC, '')

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.YEAR, 1)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.SEC, 0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.SEC, 1.0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.DAY, -1.0)
コード例 #12
0
    def test_find_x_times_invalid_input(self):
        with self.assertRaises(ValueError):
            glyph.find_x_times(None, glyph.SEC, 1.0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, None, 1.0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.SEC, None)

        with self.assertRaises(ValueError):
            glyph.find_x_times('', glyph.SEC, 1.0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, '', 1.0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.SEC, '')

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.YEAR, 1)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.SEC, 0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.SEC, 1.0)

        with self.assertRaises(ValueError):
            glyph.find_x_times(self.dt, glyph.DAY, -1.0)