[Zope-Checkins] CVS: Zope3/lib/python/Interface/tests - testDocument.py:1.1.2.1

Jim Fulton jim@zope.com
Tue, 5 Mar 2002 18:33:50 -0500


Update of /cvs-repository/Zope3/lib/python/Interface/tests
In directory cvs.zope.org:/tmp/cvs-serv29054/tests

Added Files:
      Tag: Zope-3x-branch
	testDocument.py 
Log Message:
- Added documentation to Document

- Cleaned up the interface.

- Made the output a bit nicer.

- Wrote a test.

:)



=== Added File Zope3/lib/python/Interface/tests/testDocument.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

Revision information:
$Id: testDocument.py,v 1.1.2.1 2002/03/05 23:33:50 jim Exp $
"""

from unittest import TestCase, TestSuite, main, makeSuite
from Interface import Interface
from Interface.Attribute import Attribute

class Test(TestCase):

    def testBlech(self):
        from Interface.Document import asStructuredText

        self.assertEqual(asStructuredText(I2), '''\
I2

 I2 doc

 This interface extends:

  o _I1

 Attributes:

  a1 -- no documentation

  a2 -- a2 doc

 Methods:

  f22() -- no documentation

  f21() -- f21 doc

  f23() -- f23 doc

''')
  

def test_suite():
    return TestSuite((
        makeSuite(Test),
        ))

class _I1(Interface):
    def f11(): pass
    def f12(): pass

class I2(_I1):
    "I2 doc"

    a1 = Attribute('a1')
    a2 = Attribute('a2', 'a2 doc')
    
    def f21(): "f21 doc"
    def f22(): pass
    def f23(): "f23 doc"

if __name__=='__main__':
    main(defaultTest='test_suite')