コード例 #1
0
 def test_from_gyrs(self):
     self.assertEqual(utils.to_years(20, units='gyrs'), 2e10)
コード例 #2
0
 def test_to_gyrs(self):
     self.assertEqual(utils.to_years(2e10, units='gyrs', reverse=True), 20)
コード例 #3
0
 def test_to_log(self):
     self.assertEqual(utils.to_years(1e9, units='log', reverse=True), 9)
コード例 #4
0
 def test_invalid_name(self):
     with self.assertRaises(NameError):
         utils.to_years(1e9, 'non-existent units')
コード例 #5
0
 def test_to_seconds(self):
     self.assertEqual(utils.to_years(1, units='secs', reverse=True),
                      86400 * 365)
コード例 #6
0
 def test_from_log(self):
     self.assertEqual(utils.to_years(9, units='log'), 1e9)
コード例 #7
0
 def test_from_seconds(self):
     self.assertEqual(utils.to_years(86400 * 365, units='secs'), 1)
コード例 #8
0
 def test_to_days(self):
     self.assertEqual(utils.to_years(1, units='days', reverse=True), 365)
コード例 #9
0
 def test_from_days(self):
     self.assertEqual(utils.to_years(365, units='days'), 1)
コード例 #10
0
 def test_to_yrs(self):
     self.assertEqual(utils.to_years(15, units='yrs', reverse=True), 15)
コード例 #11
0
 def test_from_yrs(self):
     self.assertEqual(utils.to_years(15, units='yrs'), 15)