Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_compute_cdftt2000(self):
random_time = list()
random_time.append(randint(0, 2018)) # Year
random_time.append(randint(1, 12)) # Month
random_time.append(randint(1, 28)) # Date
random_time.append(randint(0, 23)) # Hour
random_time.append(randint(0, 59)) # Minute
random_time.append(randint(0, 59)) # Second
random_time.append(randint(0, 999)) # Millisecond
random_time.append(randint(0, 999)) # Microsecond
random_time.append(randint(0, 999)) # Nanosecond
x = cdflib.cdfepoch.breakdown(cdflib.cdfepoch.compute(random_time))
i = 0
for t in x:
self.assertEqual(t, random_time[i], 'Time '+str(random_time) + ' was not equal to ' + str(x))
i += 1
def test_compute_cdfepoch(self):
"""
Using random numbers for the compute tests
"""
random_time = list()
random_time.append(randint(0, 2018)) # Year
random_time.append(randint(1, 12)) # Month
random_time.append(randint(1, 28)) # Date
random_time.append(randint(0, 23)) # Hour
random_time.append(randint(0, 59)) # Minute
random_time.append(randint(0, 59)) # Second
random_time.append(randint(0, 999)) # Millisecond
x = cdflib.cdfepoch.breakdown(cdflib.cdfepoch.compute(random_time))
i = 0
for t in x:
self.assertEqual(t, random_time[i], 'Time '+str(random_time) + ' was not equal to ' + str(x))
i += 1
def test_compute_cdfepoch16(self):
random_time = list()
random_time.append(randint(0, 2018)) # Year
random_time.append(randint(1, 12)) # Month
random_time.append(randint(1, 28)) # Date
random_time.append(randint(0, 23)) # Hour
random_time.append(randint(0, 59)) # Minute
random_time.append(randint(0, 59)) # Second
random_time.append(randint(0, 999)) # Millisecond
random_time.append(randint(0, 999)) # Microsecond
random_time.append(randint(0, 999)) # Nanosecond
random_time.append(randint(0, 999)) # Picosecond
x = cdflib.cdfepoch.breakdown(cdflib.cdfepoch.compute(random_time))
i = 0
for t in x:
self.assertEqual(t, random_time[i], 'Time '+str(random_time) + ' was not equal to ' + str(x))
i += 1
def test_breakdown_cdftt2000(self):
x = cdflib.cdfepoch.breakdown(123456789101112131)
self.assertEqual(x[0], 2003)
self.assertEqual(x[1], 11)
self.assertEqual(x[2], 30)
self.assertEqual(x[3], 9)
self.assertEqual(x[4], 32)
self.assertEqual(x[5], 4)
self.assertEqual(x[6], 917)
self.assertEqual(x[7], 112)
self.assertEqual(x[8], 131)
def test_breakdown_cdfepoch16(self):
x = cdflib.cdfepoch.breakdown(np.complex128(63300946758.000000 + 176214648000.00000j))
self.assertEqual(x[0], 2005)
self.assertEqual(x[1], 12)
self.assertEqual(x[2], 4)
self.assertEqual(x[3], 20)
self.assertEqual(x[4], 19)
self.assertEqual(x[5], 18)
self.assertEqual(x[6], 176)
self.assertEqual(x[7], 214)
self.assertEqual(x[8], 648)
self.assertEqual(x[9], 0)
def test_breakdown_cdfepoch(self):
x = cdflib.cdfepoch.breakdown([62285326000000.0, 62985326000000.0])
# First in the array
self.assertEqual(x[0][0], 1973)
self.assertEqual(x[0][1], 9)
self.assertEqual(x[0][2], 28)
self.assertEqual(x[0][3], 23)
self.assertEqual(x[0][4], 26)
self.assertEqual(x[0][5], 40)
self.assertEqual(x[0][6], 0)
# Second in the array
self.assertEqual(x[1][0], 1995)
self.assertEqual(x[1][1], 12)
self.assertEqual(x[1][2], 4)
self.assertEqual(x[1][3], 19)
self.assertEqual(x[1][4], 53)
self.assertEqual(x[1][5], 20)
self.assertEqual(x[1][6], 0)