def test_default_input_uses_default_if_no_input_supplied(monkeypatch): """ The default_input() function should return the supplied default value if the user doesn't enter anything """ # Given monkeypatch.setattr("builtins.input", lambda _: "") default_string = "foobar" # When retval = wz.default_input("", default_string) # Then assert retval == default_string
def test_default_input_uses_user_supplied_value(monkeypatch): """ The default_input() function should return the value that the user enters """ # Given user_input = "A value" monkeypatch.setattr("builtins.input", lambda _: user_input) default_string = "foobar" # When retval = wz.default_input("", default_string) # Then assert retval == user_input