import unittest
from lib.month_lib import *


class TestMonthLib(unittest.TestCase):

    def testPrettify(self):

        with self.assertRaises(ValueError) as ex:
            prettify('0000')       # month 00
        self.assertEqual('Invalid ugly month!', str(ex.exception))

        with self.assertRaises(ValueError) as ex:
            prettify('0013')       # month 00
        self.assertEqual('Invalid ugly month!', str(ex.exception))

        self.assertEqual(prettify('0001'), '01/00')

    def testGetQuarterInterval(self):
        self.assertEqual(get_quarter_interval(2020, 2), ('2001', '2003'))

    def testGetTodaysQuarter(self):
        self.assertEqual(get_todays_quarter(), '20212')