def test_unit_attribute_is_set_to_None(self): """testing if the unit attribute will be set to an empty if it is set to None """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good) self.assertEqual(entry.unit, self.test_good.unit) entry.unit = None self.assertEqual(entry.unit, '')
def test_unit_attribute_is_working_properly(self): """testing if the unit attribute is working properly """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good) test_value = 'TL/hour' assert entry.unit != test_value entry.unit = test_value assert entry.unit == test_value
def test_unit_attribute_is_working_properly(self): """testing if the unit attribute is working properly """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good) test_value = 'TL/hour' self.assertNotEqual(entry.unit, test_value) entry.unit = test_value self.assertEqual(entry.unit, test_value)
def test_cost_attribute_is_set_to_None(self): """testing if the cost attribute will be set to 0 if it is set to None """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, ) assert entry.cost == self.test_good.cost entry.cost = None assert entry.cost == 0.0
def test_price_attribute_is_working_properly(self): """testing if the price attribute is working properly """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, price=10) test_value = 5.0 assert entry.price != test_value entry.price = test_value assert entry.price == test_value
def test_amount_attribute_is_set_to_None(self): """testing if the amount attribute will be set to 0 if it is set to None """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, amount=10.0) self.assertEqual(entry.amount, 10.0) entry.amount = None self.assertEqual(entry.amount, 0.0)
def test_unit_attribute_is_not_a_string(self): """testing if a TypeError will be raised if the unit attribute is set to something other than a string """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good) with pytest.raises(TypeError) as cm: entry.unit = 100.212 assert str(cm.value) == \ 'BudgetEntry.unit should be a string, not float'
def test_cost_attribute_is_set_to_None(self): """testing if the cost attribute will be set to 0 if it is set to None """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, ) self.assertEqual(entry.cost, self.test_good.cost) entry.cost = None self.assertEqual(entry.cost, 0.0)
def test_amount_attribute_is_working_properly(self): """testing if the amount attribute is working properly """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, amount=10) test_value = 5.0 self.assertNotEqual(entry.amount, test_value) entry.amount = test_value self.assertEqual(entry.amount, test_value)
def test_realized_total_attribute_is_working_properly(self): """testing if the realized_total attribute is working properly """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, realized_total=10) test_value = 5.0 self.assertNotEqual(entry.realized_total, test_value) entry.realized_total = test_value self.assertEqual(entry.realized_total, test_value)
def test_realized_total_attribute_is_working_properly(self): """testing if the realized_total attribute is working properly """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, realized_total=10) test_value = 5.0 assert entry.realized_total != test_value entry.realized_total = test_value assert entry.realized_total == test_value
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_unit_attribute_is_not_a_string(self): """testing if a TypeError will be raised if the unit attribute is set to something other than a string """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good) with self.assertRaises(TypeError) as cm: entry.unit = 100.212 self.assertEqual(str(cm.exception), 'BudgetEntry.unit should be a string, not float')
def test_price_attribute_is_working_properly(self): """testing if the price attribute is working properly """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, price=10) test_value = 5.0 self.assertNotEqual(entry.price, test_value) entry.price = test_value self.assertEqual(entry.price, test_value)
def test_price_attribute_is_set_to_None(self): """testing if the price attribute will be set to 0 if price attribute is set to None """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, price=10.0) self.assertEqual(entry.price, 10.0) entry.price = None self.assertEqual(entry.price, 0.0)
def test_realized_total_attribute_is_set_to_None(self): """testing if the realized_total attribute will be set to 0 if it is set to None """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, realized_total=10.0) self.assertEqual(entry.realized_total, 10.0) entry.realized_total = None self.assertEqual(entry.realized_total, 0.0)
def test_good_attribute_is_working_properly(self): """testing if the good attribute can be correctly set """ test_value = Good(name='Some Other Good') entry = BudgetEntry(budget=self.test_budget, good=self.test_good, amount=53) self.assertNotEqual(entry.good, test_value) entry.good = test_value self.assertEqual(entry.good, test_value)
def test_amount_attribute_is_working_properly(self): """testing if the amount attribute is working properly """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, amount=10) test_value = 5.0 assert entry.amount != test_value entry.amount = test_value assert entry.amount == test_value
def test_msrp_attribute_is_set_to_None(self): """testing if the msrp attribute will be set to 0 if msrp attribute is set to None """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, ) assert entry.msrp == self.test_good.msrp entry.msrp = None assert entry.msrp == 0.0
def test_msrp_attribute_is_set_to_None(self): """testing if the msrp attribute will be set to 0 if msrp attribute is set to None """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, ) self.assertEqual(entry.msrp, self.test_good.msrp) entry.msrp = None self.assertEqual(entry.msrp, 0.0)
def test_msrp_attribute_is_working_properly(self): """testing if the msrp attribute is working properly """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, ) test_value = 5.0 self.assertNotEqual(entry.msrp, test_value) entry.msrp = test_value self.assertEqual(entry.msrp, test_value)
def test_msrp_attribute_is_working_properly(self): """testing if the msrp attribute is working properly """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, ) test_value = 5.0 assert entry.msrp != test_value entry.msrp = test_value assert entry.msrp == test_value
def test_price_attribute_is_not_a_number(self): """testing if a TypeError will be raised if price attribute is set to something other than a number """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, price=10) with pytest.raises(TypeError) as cm: entry.price = 'some string' assert str(cm.value) == 'BudgetEntry.price should be a number, not str'
def test_realized_total_attribute_is_set_to_None(self): """testing if the realized_total attribute will be set to 0 if it is set to None """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, realized_total=10.0 ) self.assertEqual(entry.realized_total, 10.0) entry.realized_total = None self.assertEqual(entry.realized_total, 0.0)
def test_amount_attribute_is_not_a_number(self): """testing if a TypeError will be raised if amount attribute is set to something other than a number """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, amount=10) with self.assertRaises(TypeError) as cm: entry.amount = 'some string' self.assertEqual(str(cm.exception), 'BudgetEntry.amount should be a number, not str')
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_price_attribute_is_working_properly(self): """testing if the price attribute is working properly """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, price=10 ) test_value = 5.0 self.assertNotEqual(entry.price, test_value) entry.price = test_value self.assertEqual(entry.price, test_value)
def test_price_attribute_is_set_to_None(self): """testing if the price attribute will be set to 0 if price attribute is set to None """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, price=10.0 ) self.assertEqual(entry.price, 10.0) entry.price = None self.assertEqual(entry.price, 0.0)
def test_good_attribute_is_working_properly(self): """testing if the good attribute can be correctly set """ test_value = Good(name='Some Other Good') entry = BudgetEntry( budget=self.test_budget, good=self.test_good, amount=53 ) self.assertNotEqual(entry.good, test_value) entry.good = test_value self.assertEqual(entry.good, test_value)
def test_unit_attribute_is_not_a_string(self): """testing if a TypeError will be raised if the unit attribute is set to something other than a string """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good) with self.assertRaises(TypeError) as cm: entry.unit = 100.212 self.assertEqual( str(cm.exception), 'BudgetEntry.unit should be a string, not float' )
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_amount_attribute_is_working_properly(self): """testing if the amount attribute is working properly """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, amount=10 ) test_value = 5.0 self.assertNotEqual(entry.amount, test_value) entry.amount = test_value self.assertEqual(entry.amount, test_value)
def test_amount_attribute_is_set_to_None(self): """testing if the amount attribute will be set to 0 if it is set to None """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, amount=10.0 ) self.assertEqual(entry.amount, 10.0) entry.amount = None self.assertEqual(entry.amount, 0.0)
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_realized_total_attribute_is_not_a_number(self): """testing if a TypeError will be raised if realized_total attribute is set to something other than a number """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, realized_total=10) with pytest.raises(TypeError) as cm: entry.realized_total = 'some string' assert str(cm.value) == \ 'BudgetEntry.realized_total should be a number, not str'
def test_realized_total_attribute_is_working_properly(self): """testing if the realized_total attribute is working properly """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, realized_total=10 ) test_value = 5.0 self.assertNotEqual(entry.realized_total, test_value) entry.realized_total = test_value self.assertEqual(entry.realized_total, test_value)
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_good_attribute_is_set_to_None(self): """testing if a TypeError will be raised if the good attribute is set to None """ entry = BudgetEntry(budget=self.test_budget, good=Good(name='Some Good'), amount=53) with pytest.raises(TypeError) as cm: entry.good = None assert str(cm.value) == \ 'BudgetEntry.good should be a stalker.models.budget.Good ' \ 'instance, not NoneType'
def test_good_attribute_is_set_to_None(self): """testing if a TypeError will be raised if the good attribute is set to None """ entry = BudgetEntry(budget=self.test_budget, good=Good(name='Some Good'), amount=53) with self.assertRaises(TypeError) as cm: entry.good = None self.assertEqual( str(cm.exception), 'BudgetEntry.good should be a stalker.models.budget.Good 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_msrp_attribute_is_not_a_number(self): """testing if a TypeError will be raised if msrp attribute is set to something other than a number """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, ) with self.assertRaises(TypeError) as cm: entry.msrp = 'some string' self.assertEqual( str(cm.exception), 'BudgetEntry.msrp should be a number, not str' )
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' )
def test_good_attribute_is_set_to_None(self): """testing if a TypeError will be raised if the good attribute is set to None """ entry = BudgetEntry( budget=self.test_budget, good=Good(name='Some Good'), amount=53 ) with self.assertRaises(TypeError) as cm: entry.good = None self.assertEqual( str(cm.exception), 'BudgetEntry.good should be a stalker.models.budget.Good instance,' ' not NoneType' )
def test_good_attribute_is_not_a_good_instance(self): """testing if a TypeError will be raised when the good attribute is set to a value other than a Good instance """ entry = BudgetEntry( budget=self.test_budget, good=self.test_good, amount=53, ) with self.assertRaises(TypeError) as cm: entry.good = 'this is not a Good instance' self.assertEqual( str(cm.exception), 'BudgetEntry.good should be a stalker.models.budget.Good instance, ' 'not str' )