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 -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/5PHQ6FMCOF7LSBYLIP5KWMEPSDEUU7MM/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to