so just like the title says, I'm trying to create a unittest, but I'm not exactly sure why it's not working. I have "test" in the name.
Algorithms involved:
def Add_Budget(self, budget):
"""Adds the budget"""
self.budget = budget
def add_expense(self, new_expense):
"""Calculates the new budget"""
self.budget = self.budget - new_expense
return self.budget
def purchase_prompt(self):
"""Prompts user for a numerical value when adding their expense"""
is_valid = False
while is_valid == False:
try:
self.new_expense = float(input("Please enter your expense($):"))
if self.new_expense == int:
is_valid = True
except Exception as e:
print("Wrong input!")
return self.new_expense
Test:
import unittest
from Expense_Tracker import Expense
class TestCurrentBudget(unittest.TestCase):
def test_add_expense(self):
# Tests if adding the expense makes sense
E = Expense()
E.Add_Budget(2000)
self.assertEqual(E.add_expense(100), 1900)
self.assertEqual(E.purchase_prompt(), True)
I'm trying to have it come back to me as OK. It's just not running