[issue10675] unittest should have an assertChanges context manager

2011-01-20 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- components: +Tests nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10675 ___

[issue10675] unittest should have an assertChanges context manager

2010-12-10 Thread Jay Moorthi
New submission from Jay Moorthi moor...@gmail.com: It would be useful to have a new assert method in the unittest.TestCase class that checks to see if a value has changed. I wrote a quick and dirty version like so: class MySpecialTestCase(unittest.TestCase): @contextmanager def

[issue10675] unittest should have an assertChanges context manager

2010-12-10 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: I think this is the kind of thing where you are *much* better off writing a specialized assert method that exactly fits your use case. There are too many variations on this theme, IMO, for it to make sense as an stdlib method.

[issue10675] unittest should have an assertChanges context manager

2010-12-10 Thread Benjamin Peterson
Changes by Benjamin Peterson benja...@python.org: -- status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10675 ___ ___

[issue10675] unittest should have an assertChanges context manager

2010-12-10 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I concur with David Murray. Usually you care about the specific value changed to, not whether it changed at all. The changed-by variant is even more specialized and you're better of using assertEqual since you know what

[issue10675] unittest should have an assertChanges context manager

2010-12-10 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thanks for submitting the idea though. Perhaps, post it on the ASPN Cookbook or on the newsgroup to see if others are interested. -- ___ Python tracker rep...@bugs.python.org