This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Steven.Barker
Recipients Arfrever, Steven.Barker, benjamin.peterson
Date 2014-08-20.06:56:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408517799.81.0.0142698680348.issue21389@psf.upfronthosting.co.za>
In-reply-to
Content
OK, I've written some tests of the new bound method repr functionality, which I'm attaching as a patch against the current tip.

I test the basic repr output, all the cases the old code got wrong (inherited methods, overridden methods, methods called via super, and classmethods) and the strange corner cases that probably won't come up in ordinary code (such as methods manually created from callables that don't have __name__ or __qualname__ attributes).

I've also fixed the defaultdict test that was relying upon the old repr output. I don't believe there are any other places in the standard library or tests where a bound method's repr is examined.

My patch adds the tests in a new file, Lib/test/test_bound_method_repr.py. I looked to see if there was an existing file that tested similar behavior, but none that I found really seemed appropriate. If I overlooked a better place to put the new tests, please let me know and I'll update the test patch.

I'm not very experienced at writing unit tests, so comments and/or criticism is welcomed. I copied parts of the file's structure (such as the test_main() function and if __name__ == "__main__" boilerplate) from other test files, so hopefully I've stayed pretty close to the usual Python test style.
History
Date User Action Args
2014-08-20 06:56:39Steven.Barkersetrecipients: + Steven.Barker, benjamin.peterson, Arfrever
2014-08-20 06:56:39Steven.Barkersetmessageid: <1408517799.81.0.0142698680348.issue21389@psf.upfronthosting.co.za>
2014-08-20 06:56:39Steven.Barkerlinkissue21389 messages
2014-08-20 06:56:39Steven.Barkercreate