Slide 115
Slide 115 text
> assert 10 == product.amount
E AttributeError: 'NoneType' object has no attribute 'amount'
117
import pytest
from dollar import Dollar
def test_money_multiplication():
five = Dollar(5)
product = five.times(2)
assert 10 == product.amount
product = five.times(3)
assert 15 == product.amount
class Dollar:
def __init__(self, amount):
self.amount = amount
def times(self, multiplier):
self.amount *= multiplier