@pytest.fixture
def handle_text(fake_keyevent_factory, keyparser):
 def func(*args):
  for (enumval, text) in args:
   keyparser.handle(fake_keyevent_factory(enumval, text=text))
 return func

@ pytest . fixture def handle_text ( fake_keyevent_factory , keyparser ) : def func ( * args ) : for ( enumval , text ) in args : keyparser . handle ( fake_keyevent_factory ( enumval , text = text ) ) return func
helper function to handle multiple fake keypresses .