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_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_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 pytest.raises(TypeError) as cm: entry.msrp = 'some string' assert str(cm.value) == 'BudgetEntry.msrp should be a number, not str'
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_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' )