There are plenty of instances in which boilerplate code is written. One of these may involve checking the types of multiple function or method calls, which can lead to situations like the following. Consider the [Stocks] ( endpoints of IEX as used in iexfinance. There are many, many endpoints like Book, Chart, and Dividends.

Problem: Boilerplate Code

It’s clear here that we are running assert isinstance(data, pd.DataFrame) in each test method. What's the best way to clear this up? Surely we can write this in less code.

Solution: Parametrize with pytest.mark.parametrize

With pytest.mark.parametrize, we can store the value of each function call. Let's use a more general example to display how this works. Consider the class foo:

Say we’d like to test the functionality of a, b, and c.

This uses a significant amount less code.