def test_string_representation_of_user_invalid(self): user = User() user.name = 'Ann' user.gender = 'Female' user.smoker = 'Yes' self.assertEqual( str(user), '') # Return empty string repr if we are missing some parameters
def test_string_representation_of_user(self): user = User() user.name = 'Patrick' user.date_of_birth = '10-10-1988' user.gender = 'Male' user.smoker = 'No' self.assertEqual( str(user), 'Patrick was born on 10-10-1988 and is a Male non-smoker')
def test_get_name(self): name = 'Mary' user = User() user.name = name self.assertEqual(user.name, name) # Checks getter is set
def test_set_name(self): name = 'Frank' user = User() user.name = name self.assertEqual(user._name, name) # Checks private var has been set