def test_basic_solar_declination(self): """Test the calc of declination for different days of the year""" day_of_year = [1, 10, 100, 365] expected_result = [-23.1223537018, -22.1987731152, 7.20726681123, -23.2078460336] for i, dayval in enumerate(day_of_year): result = calc_solar_declination(dayval) self.assertIsInstance(result, float) self.assertAlmostEqual(result, expected_result[i])
def test_solar_dec_raises_exception(self): """Test an exception is raised if latitudes out of range""" day_of_year = -1 msg = 'Day of the year must be between 0 and 365' with self.assertRaisesRegex(ValueError, msg): calc_solar_declination(day_of_year)