Example #1
0
    def test_frequency_continuous(self):
        """ Test setting frequency to 'C' and 'None' (equivalent). """
        frequency = frequency_conv('C')
        self.assertEqual(frequency, None)
        self.assertIsInstance(frequency, type(None))

        frequency = frequency_conv(None)
        self.assertEqual(frequency, None)
        self.assertIsInstance(frequency, type(None))
Example #2
0
 def test_frequency_invalid_str(self):
     """ Test setting frequency to 'invalid', an invalid value. """
     with self.assertRaises(ValueError):
         _ = frequency_conv('invalid')
Example #3
0
 def test_frequency_invalid_fraction(self):
     """ Test setting frequency to 0.5, an invalid value. """
     with self.assertRaises(TypeError):
         _ = frequency_conv(0.5)
Example #4
0
 def test_frequency_invalid_negative(self):
     """ Test setting frequency to -1, an invalid value. """
     with self.assertRaises(ValueError):
         _ = frequency_conv(-1)
Example #5
0
 def test_frequency_annually(self):
     """ Test setting frequency to 'A'. """
     frequency = frequency_conv('A')
     self.assertEqual(frequency, 1)
Example #6
0
 def test_frequency_quarterly(self):
     """ Test setting frequency to 'Q'. """
     frequency = frequency_conv('Q')
     self.assertEqual(frequency, 4)
Example #7
0
 def test_frequency_bimonthly(self):
     """ Test setting frequency to 'BM'. """
     frequency = frequency_conv('BM')
     self.assertEqual(frequency, 6)
Example #8
0
 def test_frequency_semimonthly(self):
     """ Test setting frequency to 'SM'. """
     frequency = frequency_conv('SM')
     self.assertEqual(frequency, 24)
Example #9
0
 def test_frequency_biweekly(self):
     """ Test setting frequency to 'BW'. """
     frequency = frequency_conv('BW')
     self.assertEqual(frequency, 26)
Example #10
0
 def test_frequency_daily(self):
     """ Test setting frequency to 'D'. """
     frequency = frequency_conv('D')
     self.assertEqual(frequency, 365)
     self.assertIsInstance(frequency, int)