Further Usage of List Comprehension for Test Coverage
Learn about additional usage of list comprehensions for testing.
We'll cover the following
Writing custom test failure messages
While list comprehensions allow us to cover more test cases with less test code, they risk obfuscating our errors. If our test fails but we can’t tell which values it was asserting against, we’ll lose time debugging the failure. How would we know which ID we were testing when we had the wrong value of rain
in the test we just wrote? Let’s update that assertion to use a custom failure message:
Get hands-on with 1400+ tech skills courses.