def test_is_static(self):
     self.assertTrue(dt_freq('fx').is_static)
     self.assertFalse(dt_freq(2000, 'yr').is_static)
     self.assertFalse(dt_freq(6, 'dy').is_static)
     self.assertFalse(dt_freq(1, 'hr').is_static)
 def test_fx_parsing(self):
     self.assertEqual(dt_freq('fx'), dt_freq('static'))
     self.assertEqual(dt_freq('fx'), dt_freq(0, 'fx'))
     self.assertEqual(dt_freq('fx'), dt_freq(1, 'fx'))
     self.assertEqual(dt_freq('fx').format(), 'fx')
 def test_fx_comparisons(self):
     self.assertTrue(dt_freq('fx') > dt_freq(2000, 'yr'))
     self.assertTrue(dt_freq('fx') > dt_freq(6, 'dy'))
     self.assertTrue(dt_freq('fx') > dt_freq(1, 'wk'))
 def test_minmax_different_unit(self):
     test = [dt_freq(n, 'dy') for n in [2, 7, 1]]
     test = test + [dt_freq(n, 'hr') for n in [12, 36, 3]]
     test = test + [dt_freq(n, 'wk') for n in [3, 1]]
     self.assertEqual(max(test), dt_freq(3, 'wk'))
     self.assertEqual(min(test), dt_freq(3, 'hr'))
 def test_minmax_same_unit(self):
     test = [dt_freq(n, 'hr') for n in [6, 1, 12, 36, 3]]
     self.assertEqual(max(test), dt_freq(36, 'hr'))
     self.assertEqual(min(test), dt_freq(1, 'hr'))
 def test_comparisons_different_unit(self):
     self.assertTrue(dt_freq(3, 'hr') < dt_freq(2, 'dy'))
     self.assertTrue(dt_freq(2, 'yr') > dt_freq(6, 'mo'))
     self.assertTrue(dt_freq(7, 'dy') <= dt_freq(1, 'wk'))
     self.assertTrue(dt_freq(24, 'hr') >= dt_freq(1, 'dy'))
     self.assertTrue(dt_freq(1, 'hr') <= dt_freq(2, 'yr'))
 def test_comparisons_same_unit(self):
     self.assertTrue(dt_freq(1, 'hr') < dt_freq(2, 'hr'))
     self.assertTrue(dt_freq(5, 'yr') > dt_freq(2, 'yr'))
     self.assertTrue(dt_freq(1, 'se') <= dt_freq(1, 'se'))
     self.assertTrue(dt_freq(2, 'mo') >= dt_freq(2, 'mo'))
     self.assertTrue(dt_freq(1, 'hr') <= dt_freq(2, 'hr'))
 def test_string_parsing(self):
     self.assertEqual(dt_freq('1hr'), dt_freq(1, 'hr'))
     self.assertEqual(dt_freq('5yr'), dt_freq(5, 'yr'))
     self.assertEqual(dt_freq('monthly'), dt_freq(1, 'mo'))
     self.assertEqual(dt_freq('daily'), dt_freq(1, 'dy'))
     self.assertEqual(dt_freq('120hr'), dt_freq(120, 'hr'))
     self.assertEqual(dt_freq('2 weeks'), dt_freq(2, 'wk'))