Пример #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)