Solutions will be available when this assignment is resolved, or after a few failing attempts.

Baking Cookies

Create a simple class Cookie that is initialized by providing two arguments: scarf and buttons. The class should initialize the both arguments and also a third one hat that should be None. Example:

c1 = Cookie(scarf='green', buttons='blue')
print(c1.scarf)  # 'green'
print(c1.buttons)  # 'blue'
print(c1.hat)  # None

c2 = Cookie(scarf='yellow', buttons='red')
print(c2.scarf)  # 'yellow'
print(c2.buttons)  # 'red'
print(c2.hat)  # None

Test Cases

test init attributes - Run Test

def test_init_attributes():
    c1 = Cookie(scarf='green', buttons='blue')
    assert isinstance(c1, object) is True

    assert hasattr(c1, 'scarf') is True
    assert c1.scarf == 'green'

    assert hasattr(c1, 'buttons') is True
    assert c1.buttons == 'blue'

    assert hasattr(c1, 'hat') is True
    assert c1.hat is None