[Python-Dev] Re: fail keyword like there is pass keyword

2020年10月23日 15:46:07 -0700

On 24/10/20 7:52 am, Umair Ashraf wrote:
class MyTest(unittest.TestCase):
  def test_this_and_that(self):
    """
    Given inputs
    When action is done
    Then it should pass
    """
    fail
def fail():
 raise Exception("It didn't work!")
Not every one-line function needs to be a keyword!
I feel this *fail* keyword is needed to write a test first which fails and then write code and then come back to the test and fill its body.
Um, that's not quite how TDD is supposed to work. You don't explicitly
write the *test* so that it fails. You write a proper test, and it
fails initially because you haven't yet written the code that it tests.
--
Greg
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/5PHQ6FMCOF7LSBYLIP5KWMEPSDEUU7MM/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to