hhursev / recipe-scrapers

Python package for scraping recipes data
MIT License
1.6k stars 505 forks source link

Data-driven tests: create subtests only for optional fields with expectations. #1113

Closed jayaddison closed 2 months ago

jayaddison commented 2 months ago

A fairly nitpicky change, this one - and it doesn't affect the report output when running python -m unittest, so it's not expected to have much effect.

Basically the principle here is that a unit test requires at least one assertion to be made, so in cases where we know that we won't be making an assertion, we should skip the subtest creation.

Noticed during code review at https://github.com/hhursev/recipe-scrapers/pull/1061#discussion_r1584590732

jayaddison commented 2 months ago

Thanks @strangetom!