Re: RFC: Proposed new style for documenting and testing ZTK packages

Wichert Akkerman <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
On 4/19/10 15:48 , Marius Gedminas wrote:
>      def doctest_MyClass_bar():
>          """Test MyClass.bar
>
>              >>>  y = MyClass()
>
>           The bar method peforms a bar calculation that typically returns
>           twenty-three:
>
>              >>>  y.bar()
>              23
>
>          """

What is the advantage of that over:

     def test_something(self):
          # Test MyClass.bar

          y=MyClass()

          # The bar method peforms a bar calculation that typically
          # returns 23.

          self.assertEqual(y.bar(), 23)

It reads the same, and as a bonus you can step through it with pdb and 
syntax highlighting works normally in most editors.

Wichert.
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.