def add_donation_to_list(obj): while True: name = input_name(obj) if not name: break dollars = input_dollars(name, obj) if name and dollars: thank_you(name, dollars)
def test_input_dollars_error_new_name( monkeypatch): # tests new name with value error monkeypatch.setattr('builtins.input', lambda x: "a") gd1 = make_group_for_testing() with pytest.raises(ValueError): testdata = input_dollars('JD', gd1)
def test_input_dollars_lt_1_new_name( monkeypatch): # tests new name with dollars <= 0 monkeypatch.setattr('builtins.input', lambda x: "0") gd1 = make_group_for_testing() testdata = input_dollars('JD', gd1) assert testdata == None
def test_input_dollars_lt_1( monkeypatch): # tests name from dict with dollars <= 0 monkeypatch.setattr('builtins.input', lambda x: "0") gd1 = make_group_for_testing() testdata = input_dollars('John Doe', gd1) assert testdata == None