[TIP] Mock objects in testing object composition?
benji at benjiyork.com
Tue Apr 24 13:45:42 PDT 2007
Julius Lucks wrote:
> I would like
> to separate Grid tests from dependance on Tile so that later on down the
> road when I change the Tile class and break it, then my Grid tests don't
> start to fail for this reason. Is this not a good way of thinking?
It sounds ideal, but like so many ideals its cost is likely greater than
I wouldn't worry about it. One day your Tile and Grid tests start
failing, you look at one or the other and realize pretty quickly that
Tile is at fault, you fix Tile and Grid is happy too. Not to mention
that you making changes to Tile is what caused the tests to start
failing, so you'll have a pretty good idea what happened.
More information about the testing-in-python