In Python land I typically name my methods test_[method under test]_[expected behavior]?_when_[preconditions], so my tests look like:
test_[method under test]_[expected behavior]?_when_[preconditions]
With my recent adoption of pytest for a lot of stuff, though, I also parameterize tests where I can which ends up making the test method names more generic.
I like parameterized tests as well. It's a nice way to cover multiple cases, that share the same assert statements.
I'm not great at Python. Is the "test_" at the beginning of the method required for the testrunner to identify the tests, or is it "just" convention?
Yep, that's often the pattern that a test runner looks for! I think most can be customized to find other patterns too, and I recently saw a pytest plugin that makes it easy not to have to type "test" so many times in code you already know is tests.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.