def test_valid_years(self):
     n_tests = 0
     for y in range(1583, 2600):
         argv = ['', str(y)]
         self.assertEqual(c.main(argv), test_Pasqua.readDB(str(y)))
         n_tests += 1
     print('Effettuati ' + str(n_tests) + ' test (con anni validi)')
Exemplo n.º 2
0
    def test_year_sequence(self):

        inputs = ['2000', 'test', '1582']

        try:
            fake_input = inputs.pop
            original_raw_input = __builtins__.raw_input
            __builtins__.raw_input = lambda _: fake_input()

            with captured_output() as (out, err):
                main()
                output = out.getvalue().strip()

            self.assertEqual(output, '23 April 2000')

        finally:
            __builtins__.raw_input = original_raw_input
Exemplo n.º 3
0
    def test_easter(self):

        try:
            original_raw_input = __builtins__.raw_input

            __builtins__.raw_input = lambda _: '2018'
            with captured_output() as (out, err):
                main()
                output = out.getvalue().strip()
            self.assertEqual(output, '01 April 2018')

            __builtins__.raw_input = lambda _: '1980'
            with captured_output() as (out, err):
                main()
                output = out.getvalue().strip()
            self.assertEqual(output, '06 April 1980')

        finally:
            __builtins__.raw_input = original_raw_input
Exemplo n.º 4
0
 def test_2600(
         self
 ):  # anno non gestito dal programma -> il risultato atteso è None
     argv = ['', '2600']
     self.assertEqual(c.main(argv), None)
Exemplo n.º 5
0
 def test_1609(
         self):  # anno che presenta una eccezione sull'algoritmo di gauss
     argv = ['', '1609']
     self.assertEqual(c.main(argv), '19 Aprile 1609')
Exemplo n.º 6
0
 def test_2016(self):
     argv = ['', '2016']
     self.assertEqual(c.main(argv), '27 Marzo 2016')
Exemplo n.º 7
0
 def test_2018(self):
     argv = ['', '2018']
     self.assertEqual(c.main(argv), '1 Aprile 2018')
 def test_invalid_years_2(self):
     argv = ['', '2600']
     self.assertEqual(c.main(argv), None)
 def test_invalid_years_1(self):
     argv = ['', '1582']
     self.assertEqual(c.main(argv), None)