def days_in_a_month(year, month): if month < 1 or month > 12: return 'Invalid month' else: month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] if leap_year(year): month_days[1] = 29 return month_days[month - 1]
def test_three(self): self.assertIsNotNone(leap_year(90)) self.assertFalse(leap_year(90)) self.assertIsNotNone(leap_year(150)) self.assertFalse(leap_year(150)) self.assertIsNotNone(leap_year(290)) self.assertFalse(leap_year(290))
def test_onehundred(self): self.assertIsNotNone(leap_year(100)) self.assertFalse(leap_year(100)) self.assertIsNotNone(leap_year(300)) self.assertFalse(leap_year(300)) self.assertIsNotNone(leap_year(1900)) self.assertFalse(leap_year(1900))
def test_correct(self): self.assertEqual(leap_year(3), False)
def test_leap_year_expect_false() -> None: assert not leap_year(2001)
def test_92_must_return_true(self): self.assertTrue(leap_year(92))
def test_should_return_false_if_year_equals_1742(): assert leap_year(1742) == False
def check_leap_year(year, status): ret_val = leap_year(year) assert ret_val == status
def test_leap_year_handles_bad_input(year, message, opts): with pytest.raises(LeapYearError, match=message): leap_year(year, **opts)
def test_should_return_true_if_year_equals_1888(): assert leap_year(1888) == True
def test_4の倍数(self): l=leap_year.leap_year(2016) self.assertEqual(l,True)
def test_should_return_true_if_year_equals_1600(): assert leap_year(1600) == True
def test_should_return_true_if_year_equals_1732(): assert leap_year(1732) == True
def test_should_return_false_if_year_equals_2011(): assert leap_year(2011) == False
def test_should_return_false_if_year_equals_1951(): assert leap_year(1951) == False
def test_should_return_false_if_year_equals_1889(): assert leap_year(1889) == False
def test_100の倍数(self): l=leap_year.leap_year(1900) self.assertEqual(l,False)
def test_should_return_true_if_year_equals_1944(): assert leap_year(1944) == True
def test_400の倍数(self): l=leap_year.leap_year(2000) self.assertEqual(l,True)
def test_should_return_true_if_year_equals_2008(): assert leap_year(2008) == True
import leap_year leap_year.leap_year()
def test_four(self): self.assertTrue(leap_year(60)) self.assertTrue(leap_year(80)) self.assertTrue(leap_year(2020))
def test_leap_year(year, is_leap_year, opts): assert leap_year(year, **opts) == is_leap_year
def test_800_must_return_true(self): self.assertTrue(leap_year(800))
def test_should_return_a_bool(): assert type(leap_year(1000)) == bool
def test_correct4(self): self.assertEqual(leap_year(100), False)
def test_100_must_return_false(self): self.assertFalse(leap_year(100))
def test_should_return_false_if_year_equals_500(): assert leap_year(500) == False
def test_1994_must_return_false(self): self.assertFalse(leap_year(1994))
def test_fourhundred(self): self.assertTrue(leap_year(1000)) self.assertTrue(leap_year(400))
def test_negative(self): self.assertEqual(leap_year("4 BC"), None)
def test_4の倍数じゃない(self): l=leap_year.leap_year(89) self.assertEqual(l,False)
def test_correct2(self): self.assertEqual(leap_year(4), True)
def test_leap_year_expect_true() -> None: assert leap_year(2000)