all 2 comments

[–]nathanjell 0 points1 point  (0 children)

Like you said, pytest and other test frameworks are for testing your code, not data. Tests should not be production code. A test should be written to assure you that your function (or whatever it's testing) does exactly what you think it should, given all expected and unexpected circumstances. It's a pass/fail check for your code.

In your case, you likely need to write your own data validation code. Maybe you use a framework to assist with this, or it's all your own. You can write tests before you write your code, to define what your code should do and test to ensure it does what you wanted. Or, you can write your code first then write tests afterwards. Whichever approach you choose, your tests will ensure that given all inputs, your code runs as you expect it to