[Python-bugs-list] [ python-Bugs-804115 ] bad argument handling(unittest.py)

SourceForge.net noreply at sourceforge.net
Mon Sep 15 07:03:26 EDT 2003


Bugs item #804115, was opened at 2003-09-11 03:19
Message generated for change (Comment added) made by purcell
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=804115&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: George Yoshida (quiver)
Assigned to: Raymond Hettinger (rhettinger)
Summary: bad argument handling(unittest.py)

Initial Comment:
_WritelnDecorator.writeln method handles arbitrary 

number of argumetns badly.



In the following part,



    def writeln(self, *args):

        if args: self.write(*args)



since _WritelnDecorator's stream is by default 

sys.stderr,

sys.stderr.write() takes exactly one argument.



If you give more than one argument to writeln 

method,

TypeError is raised.

----------------------------------------------------------------------

>Comment By: Steve Purcell (purcell)
Date: 2003-09-15 13:03

Message:
Logged In: YES 
user_id=21477

Raymond: I've checked in the __all__ changes as you suggested. 
 
I'd be delighted if you would amend the docs to cover the doctest 
extensions. 

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2003-09-14 20:33

Message:
Logged In: YES 
user_id=80475

Steve, if it is okay with you, I would like to add an __all__ 

declaration and amend the docs to include a reference to how 

to include doctests as unittests (Jim Fulton's doctest 

extensions).



__all__ = 

['TestResult', 'TestCase', 'TestSuite', 'TextTestRunner',

           'TestLoader', 'FunctionTestCase',

           'main', 'defaultTestLoader']



# Expose obsolete functions for backwards compatability

__all__.extend

(['getTestCaseNames', 'makeSuite', 'findTestCases'])

----------------------------------------------------------------------

Comment By: Steve Purcell (purcell)
Date: 2003-09-14 14:03

Message:
Logged In: YES 
user_id=21477

I don't exactly understand why this was considered to be an issue, since 
writeln() is in the _WritelnDecorator class, which is only ever used by 
TextTestRunner. Anyway, the fix is just fine. Thanks for taking care of it. 

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2003-09-13 04:59

Message:
Logged In: YES 
user_id=80475

Fixed.

See Lib/unittest.py 1.25 and 1.24.6.1

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=804115&group_id=5470



More information about the Python-bugs-list mailing list