def patterns_span_multiple_lines(self): r = Responder(pattern=r'call.*problem', response='So sorry') output = """ You only call me when you have a problem You never call me Just to say hi """ eq_(list(r.submit(output)), ['So sorry'])
def patterns_span_multiple_lines(self): r = Responder(pattern=r"call.*problem", response="So sorry") output = """ You only call me when you have a problem You never call me Just to say hi """ assert list(r.submit(output)) == ["So sorry"]
def multiple_hits_within_stream_yield_multiple_responses(self): r = Responder(pattern='jump', response='how high?') eq_(list(r.submit('jump, wait, jump, wait')), ['how high?'] * 2)
def yields_response_when_regex_seen(self): r = Responder(pattern=r'tech.*debt', response='pay it down') eq_(list(r.submit("technically, it's still debt")), ['pay it down'])
def yields_response_when_regular_string_pattern_seen(self): r = Responder(pattern='empty', response='handed') eq_(list(r.submit('the house was empty')), ['handed'])
def multiple_hits_within_stream_yield_multiple_responses(self): r = Responder(pattern="jump", response="how high?") assert list(r.submit("jump, wait, jump, wait")) == ["how high?"] * 2
def yields_response_when_regex_seen(self): r = Responder(pattern=r"tech.*debt", response="pay it down") response = r.submit("technically, it's still debt") assert list(response) == ["pay it down"]
def yields_response_when_regular_string_pattern_seen(self): r = Responder(pattern="empty", response="handed") assert list(r.submit("the house was empty")) == ["handed"]