def addMoney(): User.setAccount(Utils.inputHelp("账号")) Bank.setMoney(Utils.inputHelp("存储金额")) start = Bank.bank_addMoney(User.getAccount(),Bank.getMoney()) if start == 1: print("存入成功!") if start == False: print("您输入的账号不存在!")
class TestAddMoney(unittest.TestCase): user = None address = None bank = None def setUp(self) -> None: self.user = User() self.bank = Bank() self.address = Address() def test_addMoney1(self): # 1.准备测试数据 self.user.setAccount("kkk666") self.bank.setMoney("666") # 2.预期结果 teststart = 1 # 3.调用被测方法 start = self.bank.bank_addMoney(self.user.getAccount(), self.bank.getMoney()) # 4.断言 self.assertEqual(teststart, start)