def test_unit_attribute_is_working_properly(self): """testing if the unit attribute value can be changed properly """ test_value = 'this is my unit' g = Good(**self.kwargs) self.assertNotEqual(g.unit, test_value) g.unit = test_value self.assertEqual(g.unit, test_value)
def test_unit_attribute_is_working_properly(self): """testing if the unit attribute value can be changed properly """ test_value = 'this is my unit' g = Good(**self.kwargs) assert g.unit != test_value g.unit = test_value assert g.unit == test_value
def test_unit_attribute_is_set_to_None(self): """testing if the unit attribute will be an empty string if it is set to None """ g = Good(**self.kwargs) assert g.unit != '' g.unit = None assert g.unit == ''
def test_unit_attribute_is_set_to_None(self): """testing if the unit attribute will be an empty string if it is set to None """ g = Good(**self.kwargs) self.assertNotEqual(g.unit, '') g.unit = None self.assertEqual(g.unit, '')
def test_unit_attribute_is_not_a_string(self): """testing if a TypeError will be raised if the unit attribute is set to a value which is not a string """ g = Good(**self.kwargs) with pytest.raises(TypeError) as cm: g.unit = 2342 assert str(cm.value) == \ 'Good.unit should be a string, not int'
def test_unit_attribute_is_not_a_string(self): """testing if a TypeError will be raised if the unit attribute is set to a value which is not a string """ g = Good(**self.kwargs) with self.assertRaises(TypeError) as cm: g.unit = 2342 self.assertEqual(str(cm.exception), 'Good.unit should be a str, not int')
def test_unit_attribute_is_not_a_string(self): """testing if a TypeError will be raised if the unit attribute is set to a value which is not a string """ g = Good(**self.kwargs) with self.assertRaises(TypeError) as cm: g.unit = 2342 self.assertEqual( str(cm.exception), 'Good.unit should be a str, not int' )