{"version":"1.0","type":"rich","title":"Even better parameterized pytest boilerplate","description":"This example demonstrates how to test the `is_prime` function across multiple input-output pairs using pytest’s parameterized testing. It shows a table of seven cases, ranging from negative numbers to large primes, each paired with an expected boolean result. The code uses the `@pytest.mark.parametrize` decorator to define the `x` and `output` arguments, then asserts that `is_prime(x)` matches the expected output. The test data is written directly in the decorator’s list, sourced from James Routley’s blog, and the test runs each case as a separate pytest test.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-5b36ae5d250aa3b4ff965a2ab7ca27ef?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}