示例#1
0
    def test_gregorian_julian_option(self):
        """Test --output specifying Gregorian and Julian calendars.

        These options are incompatible, so the program terminates with an
        error.
        """
        with self.assertRaises(SystemExit):
            hbcal("hbcal -ic -o gregorian julian -fphonetics 17 8 1750")
示例#2
0
 def test_long_option_multiple_calendars(self):
     """Test use of one --output option (long) with 2 calendars"""
     output = hbcal("hbcal -ic --output julian hebrew -fphonetics" +
                    " 17 8 2015")
     self.assertEqual(2, len(output))
     self.assertEqual('Monday 4 August 2015', output[0])
     self.assertEqual('Monday 2 Ellul 5775', output[1])
示例#3
0
 def test_multiple_long_options(self):
     """Test double use of --output (long version)"""
     output = hbcal("hbcal -ic --output julian --output hebrew" +
                    " -fphonetics 17 8 2015")
     self.assertEqual(2, len(output))
     self.assertEqual('Monday 4 August 2015', output[0])
     self.assertEqual('Monday 2 Ellul 5775', output[1])
示例#4
0
 def test_julian_hebrew_daf_option_2015(self):
     """Test --output specifying Julian, Hebrew and Daf Yomi."""
     output = hbcal("hbcal -ic -o julian hebrew daf -fphonetics 17 8 2015")
     self.assertEqual(3, len(output))
     self.assertEqual('Monday 4 August 2015', output[0])
     self.assertEqual('Monday 2 Ellul 5775', output[1])
     self.assertEqual('Nedarim 85', output[2])
示例#5
0
    def test_short_option_abbreviated(self):
        """Test '-fp' in command line.

        This tests a short option with an abbreviated value.
        """
        output = hbcal("hbcal -ih -o -s -fp 1 8 5775")
        self.assertEqual('Noach', output[0])
示例#6
0
    def test_early_morning(self):
        """Test molad before 6am.

        This was added as a regression test because it used to fail.
        """
        output = hbcal("hbcal -m -ih -oc 1 6 5775")
        self.assertEqual('Saturday 15 August 2015 04:23 and 8 parts',
                         output[0])
示例#7
0
    def test_default_1750(self):
        """Test default value of --output parameter before 1752.

        No daf is output because the date precedes the inauguration
        of Daf Yomi.
        """
        output = hbcal("hbcal -ic -fphonetics 17 8 1750")
        self.assertEqual(1, len(output))
        self.assertEqual('Friday 26 Av 5510', output[0])
示例#8
0
    def test_julian_daf_option_1750(self):
        """Test --output specifying Julian and Daf Yomi before 1752.

        No daf is output because the date precedes the inauguration
        of Daf Yomi.
        """
        output = hbcal("hbcal -ic -o julian daf -fphonetics 17 8 1750")
        self.assertEqual(1, len(output))
        self.assertEqual('Friday 17 August 1750', output[0])
示例#9
0
    def test_civil_hebrew_daf_option_1750(self):
        """Test --output specifying civil, Hebrew and Daf Yomi before 1752.

        No daf is output because the date precedes the inauguration
        of Daf Yomi.
        """
        output = hbcal("hbcal -ic -o civil hebrew daf -fphonetics 17 8 1750")
        self.assertEqual(2, len(output))
        self.assertEqual('Friday 17 August 1750', output[0])
        self.assertEqual('Friday 26 Av 5510', output[1])
示例#10
0
    def test_same_tractate(self):
        """Test daf yomi input calendar at the start/end of a tractate.

        The current date is the last civil date of the tractate.
        The daf yomi calendar is bound to the Hebrew calendar (command line
        options). However, the time is before 6pm. Therefore the requested
        date is for daf 21 of the old tractate.
        """
        output = hbcal("hbcal -id --dafbind hebrew -fphonetics 21")
        self.assertEqual(2, len(output))
        self.assertEqual('Monday 16 November 2015', output[0])
        self.assertEqual('Monday 4 Kislev 5776', output[1])
示例#11
0
    def test_same_daf_yomi_cycle(self):
        """Test daf yomi input calendar at the start/end of a cycle.

        The current date is the last civil date of the cycle.
        The daf yomi calendar is bound to the Hebrew calendar (command line
        options). However, the time is before 6pm. Therefore the requested
        date is for Pesachim 21 of the old cycle.
        """
        output = hbcal("hbcal -id --dafbind hebrew -fphonetics 21 4")
        self.assertEqual(2, len(output))
        self.assertEqual('Tuesday 7 February 2006', output[0])
        self.assertEqual('Tuesday 9 Shevat 5766', output[1])
示例#12
0
    def test_same_daf_yomi_cycle(self):
        """Test daf yomi input calendar at the start/end of a tractate.

        The current date is the last civil date of the tractate.
        The daf yomi calendar is bound to the Hebrew calendar (command line
        options) and the time is after 6pm. Therefore the requested date is
        for Pesachim 21 of the new cycle.
        """

        output = hbcal("hbcal -id --dafbind hebrew -fphonetics 21 4")
        self.assertEqual(2, len(output))
        self.assertEqual('Thursday 11 July 2013', output[0])
        self.assertEqual('Thursday 4 Av 5773', output[1])
示例#13
0
    def test_same_tractate(self):
        """Test daf yomi input calendar at the start/end of a tractate.

        The current date is the last civil date of the tractate.
        The daf yomi calendar is bound to the Hebrew calendar (command line
        options) and the time is after 6pm. Therefore the requested date is
        daf 21 of the new tractate.
        """

        output = hbcal("hbcal -id --dafbind hebrew -fphonetics 21")
        self.assertEqual(2, len(output))
        self.assertEqual('Sunday 3 January 2016', output[0])
        self.assertEqual('Sunday 22 Teveth 5776', output[1])
示例#14
0
 def test_same_month_minus_date(self):
     output = hbcal("hbcal -ic -fphonetics -1")
     self.assertEqual(2, len(output))
     self.assertEqual('Sunday 31 January 2010', output[0])
     self.assertEqual('Sunday 16 Shevat 5770', output[1])
示例#15
0
 def test_julian_option_1750(self):
     """Test --output with Julian calendar before 1752"""
     output = hbcal("hbcal -ic -o julian -fphonetics 17 8 1750")
     self.assertEqual(1, len(output))
     self.assertEqual('Friday 17 August 1750', output[0])
示例#16
0
 def test_same_daf_yomi_cycle(self):
     output = hbcal("hbcal -id -fphonetics 21 4")
     self.assertEqual(2, len(output))
     self.assertEqual('Tuesday 7 February 2006', output[0])
     self.assertEqual('Tuesday 9 Shevat 5766', output[1])
示例#17
0
 def test_hebrew_option_5775(self):
     """Test --output with Hebrew calendar"""
     output = hbcal("hbcal -ic -o hebrew -fphonetics 17 8 2015")
     self.assertEqual(1, len(output))
     self.assertEqual('Monday 2 Ellul 5775', output[0])
示例#18
0
 def test_same_tractate(self):
     output = hbcal("hbcal -id -fphonetics 21")
     self.assertEqual(2, len(output))
     self.assertEqual('Friday 11 September 2009', output[0])
     self.assertEqual('Friday 22 Ellul 5769', output[1])
示例#19
0
 def test_same_year_hebrew(self):
     output = hbcal("hbcal -ih -fphonetics 21 4")
     self.assertEqual(2, len(output))
     self.assertEqual('Saturday 3 July 2010', output[0])
     self.assertEqual('Saturday 21 Tammuz 5770', output[1])
示例#20
0
 def test_same_month_hebrew(self):
     output = hbcal("hbcal -ih -fphonetics 21")
     self.assertEqual(2, len(output))
     self.assertEqual('Thursday 7 January 2010', output[0])
     self.assertEqual('Thursday 21 Teveth 5770', output[1])
示例#21
0
 def test_daf_option_5775(self):
     """Test --output with Daf Yomi calendar"""
     output = hbcal("hbcal -ic -o daf -fphonetics 17 8 2015")
     self.assertEqual(1, len(output))
     self.assertEqual('Nedarim 85', output[0])
示例#22
0
 def test_same_year_julian(self):
     output = hbcal("hbcal -ij -fphonetics 21 4")
     self.assertEqual(2, len(output))
     self.assertEqual('Monday 4 May 2009', output[0])
     self.assertEqual('Monday 10 Iyar 5769', output[1])
示例#23
0
 def test_same_month_julian(self):
     output = hbcal("hbcal -ij -fphonetics 21")
     self.assertEqual(2, len(output))
     self.assertEqual('Sunday 3 January 2010', output[0])
     self.assertEqual('Sunday 17 Teveth 5770', output[1])
示例#24
0
 def test_today_daf(self):
     output = hbcal("hbcal -id -fphonetics")
     self.assertEqual(2, len(output))
     self.assertEqual('Friday 1 January 2010', output[0])
     self.assertEqual('Friday 15 Teveth 5770', output[1])
示例#25
0
 def test_same_month_gregorian(self):
     output = hbcal("hbcal -ig -fphonetics 21")
     self.assertEqual(2, len(output))
     self.assertEqual('Thursday 21 January 2010', output[0])
     self.assertEqual('Thursday 6 Shevat 5770', output[1])
示例#26
0
 def test_minus_month(self):
     output = hbcal("hbcal -ic -fphonetics 21 -1")
     self.assertEqual(2, len(output))
     self.assertEqual('Tuesday 21 December 2010', output[0])
     self.assertEqual('Tuesday 14 Teveth 5771', output[1])
示例#27
0
 def test_same_year_gregorian(self):
     output = hbcal("hbcal -ig -fphonetics 21 4")
     self.assertEqual(2, len(output))
     self.assertEqual('Wednesday 21 April 2010', output[0])
     self.assertEqual('Wednesday 7 Iyar 5770', output[1])
示例#28
0
 def test_today_hebrew(self):
     output = hbcal("hbcal -ih -fphonetics")
     self.assertEqual(2, len(output))
     self.assertEqual('Saturday 2 January 2010', output[0])
     self.assertEqual('Saturday 16 Teveth 5770', output[1])
示例#29
0
 def test_same_month_zero_date(self):
     with self.assertRaises(SystemExit):
         hbcal("hbcal -ic -fphonetics 0")
示例#30
0
 def test_today_daf_hebrew(self):
     """Test daf yomi input calendar when bound to Hebrew calendar"""
     output = hbcal("hbcal -id --dafbind hebrew -fphonetics")
     self.assertEqual(2, len(output))
     self.assertEqual('Saturday 2 January 2010', output[0])
     self.assertEqual('Saturday 16 Teveth 5770', output[1])