Ejemplo n.º 1
0
 def test_no_holiday_zipcode(self):
     for federal_state_row in holiday_data.federal_state_holiday:
         federal_state = federal_state_row['federal_state']
         zipcode = test_zipcodes_data.get_zipcodes(federal_state)[0]
         for holiday_date in federal_state_row['not-bank-holiday']:
             self.assertFalse(
                 self.holideo.is_bank_holiday_at_zipcode(
                     holiday_date, zipcode), str(holiday_date))
Ejemplo n.º 2
0
 def test_holidays_many_zipcodes(self):
     for federal_state_row in holiday_data.federal_state_holiday:
         federal_state = federal_state_row['federal_state']
         zipcodelist = test_zipcodes_data.get_zipcodes(federal_state)
         for holiday_date in federal_state_row['bank-holiday']:
             for zipcode in zipcodelist:
                 self.assertTrue(
                     self.holideo.is_bank_holiday_at_zipcode(
                         holiday_date, zipcode), str(holiday_date))
Ejemplo n.º 3
0
  def test_holidays_zipcodes(self):
    for federal_state_row in school_holiday_data.federal_state_holiday:
      federal_state = federal_state_row['federal_state']
      zipcode = test_zipcodes_data.get_zipcodes(federal_state)[0]
      for holidays in federal_state_row['holiday']:

        date = holidays['starts_on']
        date -= datetime.timedelta(days=1)
        end_date = holidays['ends_on']

        while date != end_date:
          date += datetime.timedelta(days=1)
          self.assertTrue(self.holideo.is_school_holiday_at_zipcode(date, zipcode),
                          (federal_state + ' (' + str(zipcode) + '): ' + str(date)))
Ejemplo n.º 4
0
  def test_no_holidays_many_zipcodes(self):
    for federal_state_row in school_holiday_data.federal_state_holiday:
      federal_state = federal_state_row['federal_state']
      zipcode_list = test_zipcodes_data.get_zipcodes(federal_state)
      for zipcode in zipcode_list:
        for holidays in federal_state_row['not-holiday']:

          date = holidays['starts_on']
          date -= datetime.timedelta(days=1)
          end_date = holidays['ends_on']

          while date != end_date:
            date += datetime.timedelta(days=1)
            self.assertFalse(self.holideo.is_school_holiday_at_zipcode(date, zipcode),
                            (federal_state + ' (' + str(zipcode) + '): ' + str(date)))
Ejemplo n.º 5
0
    def test_holidays_zipcodes(self):
        """
    Tests whether school holidays are off date for one zipcode per federal state.
    """
        for federal_state_row in school_holiday_data.federal_state_holiday:
            federal_state = federal_state_row['federal_state']
            zipcode = test_zipcodes_data.get_zipcodes(federal_state)[0]
            for holidays in federal_state_row['holiday']:

                date_date = holidays['starts_on']
                date_date -= datetime.timedelta(days=1)
                end_date = holidays['ends_on']

                while date_date != end_date:
                    date_date += datetime.timedelta(days=1)
                    self.assertTrue(
                        self.holideo.no_school_at_zipcode(date_date, zipcode),
                        (federal_state + ' (' + str(zipcode) + '): ' +
                         str(date_date)))
Ejemplo n.º 6
0
    def test_holidays_many_zipcodes(self):
        """
    Tests whether school holidays are off school for many zipcodes.
    """
        for federal_state_row in school_holiday_data.federal_state_holiday:
            federal_state = federal_state_row['federal_state']
            zipcode_list = test_zipcodes_data.get_zipcodes(federal_state)
            for zipcode in zipcode_list:
                for holidays in federal_state_row['holiday']:

                    check_date = holidays['starts_on']
                    check_date -= datetime.timedelta(days=1)
                    end_date = holidays['ends_on']

                    while check_date != end_date:
                        check_date += datetime.timedelta(days=1)
                        self.assertTrue(
                            self.holideo.no_school_at_zipcode(
                                check_date, zipcode),
                            (federal_state + ' (' + str(zipcode) + '): ' +
                             str(check_date)))