I have a model and a controller I'm trying to test:
class Model:
def __init__(self):
self.display = ""
def set_display(self, display):
self.display = display
import pytest
from model import Model
from controller import Controller
@pytest.fixture
def model():
return Model()
@pytest.fixture
def controller(model):
return Controller(model)
def test_clear_button(controller):
controller.button_pressed("4")
controller.button_pressed("2")
controller.button_pressed("C")
assert model.display == "0"
E AttributeError: 'function' object has no attribute 'display'
Above is the errors/failures I get every time I run the test.
class Controller:
def __init__(self, model):
self.model = model
def button_pressed(self, button_label):
pass