def is_leap(self): with expect: is_leap(year) == expected_value with where: year | expected_value 1993 | False 1992 | True 1900 | False 2000 | True
def test_scenarios(year): verify("is Leap " + str(year) + ": " + str(is_leap(year)), namer=get_scenario_namer(year))
def test_leap_with_list(): results = [(year, is_leap(year)) for year in [1993, 1992, 1900, 2000]] verify_all("(year, is leap year)", results)
def atypical_leap(self): with when: result = is_leap(2000) with then: result == True
def atypical_common(self): with when: result = is_leap(1900) with then: result == False
def typical_leap(self): with when: result = is_leap(1992) with then: result == True
def common_year(self): with when: result = is_leap(1993) with then: result == False
def test_atypical_leap(): assert is_leap(2000)
def test_common_year(self): self.assertFalse(is_leap(1993))
def test_atypical_leap(self): self.assertTrue(is_leap(2000))
def test_atypical_common(self): self.assertFalse(is_leap(1900))
def test_typical_leap(self): self.assertTrue(is_leap(1992))
from leap import is_leap year = int(raw_input("Enter a year: ")) print is_leap(year)
def test_typical_leap(): assert is_leap(1992)
def test_common_year(): assert not is_leap(1993)
def step_impl(context): assert is_leap(context.year)
def step_impl(context): context.is_leap = str(is_leap(context.year))
def test_atypical_common(): assert not is_leap(1900)