예제 #1
0
 def behaves_like_regular_responder_by_default(self):
     r = FailingResponder(
         pattern='ju[^ ]{2}',
         response='how high?',
         sentinel='lolnope',
     )
     eq_(list(r.submit('jump, wait, jump, wait')), ['how high?'] * 2)
예제 #2
0
파일: watchers.py 프로젝트: brutus/invoke
 def behaves_like_regular_responder_by_default(self):
     r = FailingResponder(
         pattern='ju[^ ]{2}',
         response='how high?',
         sentinel='lolnope',
     )
     eq_(list(r.submit('jump, wait, jump, wait')), ['how high?'] * 2)
예제 #3
0
파일: watchers.py 프로젝트: yzdx0000/invoke
 def raises_failure_exception_when_sentinel_detected(self):
     r = FailingResponder(
         pattern="ju[^ ]{2}", response="how high?", sentinel="lolnope"
     )
     # Behaves normally initially
     assert list(r.submit("jump")) == ["how high?"]
     # But then!
     try:
         r.submit("lolnope")
     except ResponseNotAccepted as e:
         message = str(e)
         # Expect useful bits in exception text
         err = "Didn't see pattern in {!r}".format(message)
         assert "ju[^ ]{2}" in message, err
         err = "Didn't see failure sentinel in {!r}".format(message)
         assert "lolnope" in message, err
     else:
         assert False, "Did not raise ResponseNotAccepted!"
예제 #4
0
 def raises_failure_exception_when_sentinel_detected(self):
     r = FailingResponder(
         pattern='ju[^ ]{2}',
         response='how high?',
         sentinel='lolnope',
     )
     # Behaves normally initially
     eq_(list(r.submit('jump')), ['how high?'])
     # But then!
     try:
         r.submit('lolnope')
     except ResponseNotAccepted as e:
         message = str(e)
         # Expect useful bits in exception text
         err = "Didn't see pattern in {!r}".format(message)
         ok_("ju[^ ]{2}" in message, err)
         err = "Didn't see failure sentinel in {!r}".format(message)
         ok_("lolnope" in message, err)
     else:
         assert False, "Did not raise ResponseNotAccepted!"
예제 #5
0
파일: watchers.py 프로젝트: brutus/invoke
 def raises_failure_exception_when_sentinel_detected(self):
     r = FailingResponder(
         pattern='ju[^ ]{2}',
         response='how high?',
         sentinel='lolnope',
     )
     # Behaves normally initially
     eq_(list(r.submit('jump')), ['how high?'])
     # But then!
     try:
         r.submit('lolnope')
     except ResponseNotAccepted as e:
         message = str(e)
         # Expect useful bits in exception text
         err = "Didn't see pattern in {0!r}".format(message)
         ok_("ju[^ ]{2}" in message, err)
         err = "Didn't see failure sentinel in {0!r}".format(message)
         ok_("lolnope" in message, err)
     else:
         assert False, "Did not raise ResponseNotAccepted!"
예제 #6
0
파일: watchers.py 프로젝트: yzdx0000/invoke
 def behaves_like_regular_responder_by_default(self):
     r = FailingResponder(
         pattern="ju[^ ]{2}", response="how high?", sentinel="lolnope"
     )
     assert list(r.submit("jump, wait, jump, wait")) == ["how high?"] * 2