to help with fixture data, there is a small helper function that just overrides the values based on the kwarg you provide so your fixture is updated accordingly to test whatever it is you are testing at that moment.
Whenever I do an assert in my program I format it like assert a == 23, "got {}, expected 23".format(a) and it makes me wish there was something to autogenerate those error messages
There was a great bug in Alembic where if you did a migration then changed branches, the migration would be gone but the pyc file would remain, so migrations would get inexplicably out of sync.
> However, if you specify a message with the assertion then no assertion introspection takes places at all and the message will be simply shown in the traceback.
Old school: pushing a boulder up a hill, only for it to fall back down, forever. New school: pushing a change to production, only for automated testing to fail, forever.
Attitude like that will get you sent to the meeting room of Tantalus, where the box of donuts is juuust out of your reach, and people keep asking follow-up questions about the last item on the itinerary.
A colleague and I sometimes arg disagree about whether "sociable" unittests are allowed or whether they should be as solitary as possible. I say yes, he says no. (Yes, they should be allowed, I mean.)
I'm too lazy to do other than google: " As the name suggests, Solitary unit tests should only test functionality of one class, everything else should be stubbed or mocked. Conversely, sociable unit tests will test interactions between components, but will not go into great detail on every single collaborator."
Well, every real-world suite usually has lots of both, so it's mostly an emphasis thing, but you can definitely tell what modules he wrote the tests for and what ones I wrote the tests for because of our different leanings.
Maybe that was too strong -- "disfavoured", let's say. The argument against having too many non-solitary tests is that it's easy to bury an assumption in the coupling (in numeric code, say some normalization.)
if you're only testing one small branch of code but the test needs to touch many many other parts of the code (because you didn't mock out enough stuff) then the test suite can get very slow
when the test suite runs thousands of tests in a couple of seconds, that's really nice
and you can test on every commit
if the test suite takes 5 mins to run, you stop bothering ... you run the tests and go and make a coffee ... workflow suffers
Good grief. I'm up to ~300 example commands for a numpy tutorial and I literally haven't done ANY ARITHMETIC WHATSOEVER. Just going into how ndarrays work and are shaped.