def test_budget_attribute_is_working_properly(self): """testing if the budget attribute value can correctly be changed """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, amount=10.0) new_budget = Budget(name='Test Budget', project=self.test_project) self.assertNotEqual(entry.budget, new_budget) entry.budget = new_budget self.assertEqual(entry.budget, new_budget)
def test_budget_attribute_is_working_properly(self): """testing if the budget attribute value can correctly be changed """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, amount=10.0 ) new_budget = Budget(name='Test Budget', project=self.test_project) self.assertNotEqual(entry.budget, new_budget) entry.budget = new_budget self.assertEqual(entry.budget, new_budget)
def test_budget_attribute_is_working_properly(self): """testing if the budget attribute value can correctly be changed """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, amount=10.0) new_budget = Budget(name='Test Budget', project=self.test_project, status_list=self.budget_status_list) assert entry.budget != new_budget entry.budget = new_budget assert entry.budget == new_budget
def test_budget_attribute_is_not_a_budget_instance(self): """testing if a TypeError will be raised if the budget attribute is not set to a something that is a Budget instance """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, amount=10.0) with pytest.raises(TypeError) as cm: entry.budget = 'not a budget instance' assert str(cm.value) == \ 'BudgetEntry.budget should be a Budget instance, not str'
def test_budget_attribute_is_set_to_none(self): """testing if a TypeError will be raised if the budget attribute is set to None """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, ) with pytest.raises(TypeError) as cm: entry.budget = None assert str(cm.value) == \ 'BudgetEntry.budget should be a Budget instance, not NoneType'
def test_budget_attribute_is_set_to_none(self): """testing if a TypeError will be raised if the budget attribute is set to None """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, ) with self.assertRaises(TypeError) as cm: entry.budget = None self.assertEqual( str(cm.exception), 'BudgetEntry.budget should be a Budget instance, not NoneType')
def test_budget_attribute_is_set_to_none(self): """testing if a TypeError will be raised if the budget attribute is set to None """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, ) with self.assertRaises(TypeError) as cm: entry.budget = None self.assertEqual( str(cm.exception), 'BudgetEntry.budget should be a Budget instance, not NoneType' )
def test_budget_attribute_is_not_a_budget_instance(self): """testing if a TypeError will be raised if the budget attribute is not set to a something that is a Budget instance """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, amount=10.0 ) with self.assertRaises(TypeError) as cm: entry.budget = 'not a budget instance' self.assertEqual( str(cm.exception), 'BudgetEntry.budget should be a Budget instance, not str' )