コード例 #1
0
def test_ask_age_returns_the_input_age_as_an_integer():
    __builtin__.raw_input = MagicMock(return_value="3")
    assert_equal(ask_age(), 3)

    __builtin__.raw_input = MagicMock(return_value="65")
    assert_equal(ask_age(), 65)
コード例 #2
0
def test_ask_age_returns_the_input_age_as_an_integer():
    __builtin__.raw_input = MagicMock(return_value="3")
    assert_equal(ask_age(), 3)

    __builtin__.raw_input = MagicMock(return_value="65")
    assert_equal(ask_age(), 65)
コード例 #3
0
def test_ask_age_asks_the_user_to_enter_their_age():
    __builtin__.raw_input = MagicMock()
    ask_age()
    __builtin__.raw_input.assert_called_with('Enter your age: ')
コード例 #4
0
def test_ask_age_asks_the_user_to_enter_their_age():
    __builtin__.raw_input = MagicMock()
    ask_age()
    __builtin__.raw_input.assert_called_with('Enter your age: ')