Пример #1
0
    def test_fun(self):

        # time_cds_short
        tcds = np.array([(1, 2)], dtype=np.dtype(time_cds_short))
        expected = datetime(1958, 1, 2, 0, 0, 0, 2000)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds
        tcds = np.array([(1, 2, 3)], dtype=np.dtype(time_cds))
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds_expanded
        tcds = np.array([(1, 2, 3, 4)], dtype=np.dtype(time_cds_expanded))
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)
Пример #2
0
    def test_fun(self):
        """Test function for TestMakeTimeCdsRecarray."""
        # time_cds_short
        tcds = np.array([(1, 2)], dtype=np.dtype(time_cds_short))
        expected = datetime(1958, 1, 2, 0, 0, 0, 2000)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds
        tcds = np.array([(1, 2, 3)], dtype=np.dtype(time_cds))
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds_expanded
        tcds = np.array([(1, 2, 3, 4)], dtype=np.dtype(time_cds_expanded))
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)
Пример #3
0
    def test_fun(self):
        """Test function for TestMakeTimeCdsDictionary."""
        # time_cds_short
        tcds = {'Days': 1, 'Milliseconds': 2}
        expected = datetime(1958, 1, 2, 0, 0, 0, 2000)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds
        tcds = {'Days': 1, 'Milliseconds': 2, 'Microseconds': 3}
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds_expanded
        tcds = {'Days': 1, 'Milliseconds': 2, 'Microseconds': 3, 'Nanoseconds': 4}
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)
Пример #4
0
    def test_fun(self):

        # time_cds_short
        tcds = np.array([(1, 2)], dtype=np.dtype(time_cds_short))
        expected = datetime(1958, 1, 2, 0, 0, 0, 2000)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds
        tcds = np.array([(1, 2, 3)], dtype=np.dtype(time_cds))
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds_expanded
        tcds = np.array([(1, 2, 3, 4)], dtype=np.dtype(time_cds_expanded))
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)
Пример #5
0
    def test_fun(self):

        # time_cds_short
        tcds = {'Days': 1, 'Milliseconds': 2}
        expected = datetime(1958, 1, 2, 0, 0, 0, 2000)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds
        tcds = {'Days': 1, 'Milliseconds': 2, 'Microseconds': 3}
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds_expanded
        tcds = {'Days': 1, 'Milliseconds': 2, 'Microseconds': 3, 'Nanoseconds': 4}
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)
Пример #6
0
    def test_fun(self):

        # time_cds_short
        tcds = {'Days': 1, 'Milliseconds': 2}
        expected = datetime(1958, 1, 2, 0, 0, 0, 2000)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds
        tcds = {'Days': 1, 'Milliseconds': 2, 'Microseconds': 3}
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)

        # time_cds_expanded
        tcds = {
            'Days': 1,
            'Milliseconds': 2,
            'Microseconds': 3,
            'Nanoseconds': 4
        }
        expected = datetime(1958, 1, 2, 0, 0, 0, 2003)
        self.assertEqual(timecds2datetime(tcds), expected)