[Python-checkins] python/dist/src/Lib/test test_doctest.py, 1.9, 1.10

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Sun Aug 8 03:49:02 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30640/Lib/test

Modified Files:
	test_doctest.py 
Log Message:
Deprecated testmod's useless & confusing isprivate gimmick.
Ripped out the docs for the new DocTestFinder's namefilter argument,
and renamed it to _namefilter; this only existed to support isprivate.
Removed the new DocTestFinder's objfilter argument.  No point adding
more cruft to a broken filtering design.


Index: test_doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** test_doctest.py	7 Aug 2004 05:37:52 -0000	1.9
--- test_doctest.py	8 Aug 2004 01:48:59 -0000	1.10
***************
*** 388,410 ****
  Filter Functions
  ~~~~~~~~~~~~~~~~
! Two filter functions can be used to restrict which objects get
! examined: a name-based filter and an object-based filter.
  
      >>> def namefilter(prefix, base):
      ...     return base.startswith('a_')
!     >>> tests = doctest.DocTestFinder(namefilter=namefilter).find(SampleClass)
!     >>> tests.sort()
!     >>> for t in tests:
!     ...     print '%2s  %s' % (len(t.examples), t.name)
!      1  SampleClass
!      3  SampleClass.NestedClass
!      1  SampleClass.NestedClass.__init__
!      1  SampleClass.__init__
!      1  SampleClass.double
!      1  SampleClass.get
! 
!     >>> def objfilter(obj):
!     ...     return isinstance(obj, (staticmethod, classmethod))
!     >>> tests = doctest.DocTestFinder(objfilter=objfilter).find(SampleClass)
      >>> tests.sort()
      >>> for t in tests:
--- 388,398 ----
  Filter Functions
  ~~~~~~~~~~~~~~~~
! A filter function can be used to restrict which objects get examined,
! but this is temporary, undocumented internal support for testmod's
! deprecated isprivate gimmick.
  
      >>> def namefilter(prefix, base):
      ...     return base.startswith('a_')
!     >>> tests = doctest.DocTestFinder(_namefilter=namefilter).find(SampleClass)
      >>> tests.sort()
      >>> for t in tests:
***************
*** 414,418 ****
       1  SampleClass.NestedClass.__init__
       1  SampleClass.__init__
-      1  SampleClass.a_property
       1  SampleClass.double
       1  SampleClass.get
--- 402,405 ----
***************
*** 423,427 ****
      >>> def namefilter(prefix, base):
      ...     return base == 'NestedClass'
!     >>> tests = doctest.DocTestFinder(namefilter=namefilter).find(SampleClass)
      >>> tests.sort()
      >>> for t in tests:
--- 410,414 ----
      >>> def namefilter(prefix, base):
      ...     return base == 'NestedClass'
!     >>> tests = doctest.DocTestFinder(_namefilter=namefilter).find(SampleClass)
      >>> tests.sort()
      >>> for t in tests:
***************
*** 435,444 ****
       1  SampleClass.get
  
! The filter functions apply to contained objects, and *not* to the
  object explicitly passed to DocTestFinder:
  
      >>> def namefilter(prefix, base):
      ...     return base == 'SampleClass'
!     >>> tests = doctest.DocTestFinder(namefilter=namefilter).find(SampleClass)
      >>> len(tests)
      9
--- 422,431 ----
       1  SampleClass.get
  
! The filter function apply to contained objects, and *not* to the
  object explicitly passed to DocTestFinder:
  
      >>> def namefilter(prefix, base):
      ...     return base == 'SampleClass'
!     >>> tests = doctest.DocTestFinder(_namefilter=namefilter).find(SampleClass)
      >>> len(tests)
      9
***************
*** 1067,1071 ****
  
           >>> finder = doctest.DocTestFinder(
!          ...    namefilter=lambda prefix, base: base!='bar')
           >>> suite = doctest.DocTestSuite('test.sample_doctest',
           ...                              test_finder=finder)
--- 1054,1058 ----
  
           >>> finder = doctest.DocTestFinder(
!          ...    _namefilter=lambda prefix, base: base!='bar')
           >>> suite = doctest.DocTestSuite('test.sample_doctest',
           ...                              test_finder=finder)



More information about the Python-checkins mailing list