List with a custom length
You already saw a list preparation implemented as a fixture. But what if you also want to customize the preparation process? For example, one might want to set a custom length for a generated list. You can implement it with chain fixture requests by making the "length" a separate fixture; let's call it list_length(). In the end, you will have a test function that requests the list, and the list is then generated by requesting the list_length().
This exercise is part of the course
Introduction to Testing in Python
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
Start Exercise