예제 #1
0
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]
예제 #2
0
 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))
예제 #3
0
 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))
예제 #4
0
 def test_correct(self):
     self.assertEqual(leap_year(3), False)
예제 #5
0
def test_leap_year_expect_false() -> None:
    assert not leap_year(2001)
예제 #6
0
 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
예제 #8
0
def check_leap_year(year, status):
    ret_val = leap_year(year)
    assert ret_val == status
예제 #9
0
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
예제 #11
0
 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
예제 #17
0
 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
예제 #19
0
 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
예제 #21
0
import leap_year

leap_year.leap_year()
예제 #22
0
 def test_four(self):
     self.assertTrue(leap_year(60))
     self.assertTrue(leap_year(80))
     self.assertTrue(leap_year(2020))
예제 #23
0
def test_leap_year(year, is_leap_year, opts):
    assert leap_year(year, **opts) == is_leap_year
예제 #24
0
 def test_800_must_return_true(self):
     self.assertTrue(leap_year(800))
def test_should_return_a_bool():
    assert type(leap_year(1000)) == bool
예제 #26
0
 def test_correct4(self):
     self.assertEqual(leap_year(100), False)
예제 #27
0
 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
예제 #29
0
 def test_1994_must_return_false(self):
     self.assertFalse(leap_year(1994))
예제 #30
0
 def test_fourhundred(self):
     self.assertTrue(leap_year(1000))
     self.assertTrue(leap_year(400))
예제 #31
0
 def test_negative(self):
     self.assertEqual(leap_year("4 BC"), None)
예제 #32
0
 def test_4の倍数じゃない(self):
     l=leap_year.leap_year(89)
     self.assertEqual(l,False)
예제 #33
0
 def test_correct2(self):
     self.assertEqual(leap_year(4), True)
예제 #34
0
def test_leap_year_expect_true() -> None:
    assert leap_year(2000)