[Python-3000] Support for PEP 3131 - discussion on python zope users group
Guido van Rossum
guido at python.org
Wed May 16 18:49:16 CEST 2007
On 5/16/07, Jason Orendorff <jason.orendorff at gmail.com> wrote:
> On 5/16/07, Collin Winter <collinw at gmail.com> wrote:
> > > -> unittest - very useful to give a better overview of the result of
> > > unit test. People pointed us at a Visual C# MVP tutorial
> > > http://www.atmarkit.co.jp/fdotnet/nagile/nagile02/nagile02_03.html
> >
> > I don't know what "a better overview of the result of unit test"
> > means. Also, the linked page is in Japanese.
>
> The page illustrates how a unit test can serve as an
> executable specification. The third box of code is a
> TestFixture class with methods like this one:
>
> >> [Test][ExpectedException(typeof(ArgumentException))]
> >> public void 一年未満はエラーになる()
> >> {
> >> Date date = new Date(0, 1, 1);
> >> }
>
> The name translates to something like "if the year is
> less than one, it's an error". Interesting. Kind of a weird
> thing to do; ordinarily you wouldn't want method names
> that take so long to type. But a unit test method is a
> special case.
>
> The mix of Japanese and English is not as visually
> jarring as I expected. It actually looks kinda cool. :)
Thanks for the translation!
This meshes nicely with a pattern I've only recently learned in unit
testing -- using long descriptive names for tests so the name of the
test indicates the tested behavior (as opposed to, say, the name of
the class or method being tested).
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list