class Cookie(object): pass cookie1 = Cookie() cookie1.scarf = 'green' cookie2 = Cookie() cookie2.buttons = 'blue'
Create an empty class
Cookie. Create two instances of it. One of them named
cookie1 and the other
cookie1 should have an attribute
scarf with the value
cookie2 should have an attribute
buttons with the value
test cookie1 attributes - Run Test
def test_cookie1_attributes(): assert isinstance(cookie1, Cookie) is True, 'cookie1 is not created' assert isinstance(cookie1, object) is True assert hasattr(cookie1, 'scarf') is True, "cookie1 doesn't have a scarf attribute" assert cookie1.scarf == 'green', "Cookie1's scarf isn't green"
test cookie2 attributes - Run Test
def test_cookie2_attributes(): assert isinstance(cookie2, Cookie) is True, 'cookie2 is not created' assert isinstance(cookie2, object) is True assert hasattr(cookie2, 'buttons') is True, "cookie2 doesn't have a scarf attribute" assert cookie2.buttons == 'blue', "Cookie2's scarf isn't blue"