2 ms·
We often use the word "ensure" in test names and / or doc strings.
by funstuff007 4y ago
We often use the word "ensure" in test names and / or doc strings.
- layer8 4y agoThat's confusing. In regular code, "ensure" normally means that the code is responsible for taking the necessary steps to make a condition true if it isn't already true. For example, ensuring that a buffer is large enough by growing it if needed. Or ensuring that some data is in the cache by loading it if not already present. Tests, on the other hand, do not ensure that the condition they're testing is met. At best, they ensure that someone notices if the condition is not met.
- funstuff007 4y agoI see your point, but our tests ensure that out functions work as expected. usually when test function foo, the test is called test_foo. But if we have a function or class that will ensure that X is a valid sparrow, we have a test called ensure_valid_sparrow.