[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2016-09-13 Thread Chris Jerdonek
Chris Jerdonek added the comment: An idea occurred to me on this recently. Instead of changing TextTestResult to call test.id() everywhere instead of str(test), what about making TextTestResult DRY by having it call a new method called something like self.getName(test)? With this approach,

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2016-09-12 Thread Robert Collins
Robert Collins added the comment: @Chris - I don't like the idea of making new classes on the fly like that, it seems more likely to provoke bugs (as type(case) != SomeSpecificClass) anymore after that, vs just not relying on __str__ directly. Going back to Michael's proposal of short

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-21 Thread Michael Foord
Changes by Michael Foord mich...@voidspace.org.uk: -- assignee: - michael.foord ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16288 ___ ___

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-21 Thread Robert Collins
Robert Collins added the comment: testscenarios copies the tests, it doesn't call the constructor for the class; this makes things a lot simpler than trying to reconstruct whatever state the object may have from scratch again. As for str(test) and test.id() being different - well sure they

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-21 Thread Mike Hoy
Changes by Mike Hoy mho...@gmail.com: -- nosy: -mikehoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16288 ___ ___ Python-bugs-list mailing list

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-21 Thread Michael Foord
Michael Foord added the comment: So three including str sounds sufficient to me: short description, long description and repr (with str == repr) for debugging. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16288

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-21 Thread R. David Murray
R. David Murray added the comment: Robert: I don't know if there's something funky going on with your browser, but every time you post the 'enhancement' setting for type seems to get lost. -- type: - enhancement ___ Python tracker

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-21 Thread Robert Collins
Robert Collins added the comment: @Michael I'll put a patch together next week then. @R.david.murray no idea - but I've refreshed the page, we'll if it behaves better. My guess would be a buggy in-flight-collision detection in the issue tracker code. --

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-21 Thread Chris Jerdonek
Chris Jerdonek added the comment: testscenarios copies the tests, it doesn't call the constructor for the class; My suggestion on how to override __str__ (by assignment to __class__) doesn't require that the constructor be called. -- ___ Python

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-21 Thread R. David Murray
R. David Murray added the comment: Much more likely that you just needed to refresh the page, going by my own experience with this kind of problem (especially seeing as that seems to have fixed it :) -- ___ Python tracker rep...@bugs.python.org

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-20 Thread Mike Hoy
Changes by Mike Hoy mho...@gmail.com: -- nosy: +mikehoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16288 ___ ___ Python-bugs-list mailing list

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-20 Thread R. David Murray
R. David Murray added the comment: The special handling of special methods is baked into the attribute lookup machinery. The discussion of this is in the language reference somewhere, as is the explanation of what descriptors are and how they work. -- type: - enhancement

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: So the relevant code is this: def getDescription(self, test): ... 43 return str(test) ... What I'd like is to have this be something like: 44 return test.id() Or anther way this could be done would be to make TestCase.__str__ call self.id() Note

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-20 Thread Éric Araujo
Éric Araujo added the comment: http://docs.python.org/reference/datamodel.html#special-method-lookup-for-new-style-classes -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16288

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-19 Thread Robert Collins
New submission from Robert Collins: TextTestRunner calls str(TestCase) directly, which makes it hard for testscenarios to rename the test cases as it parameterises them (because __str__ is a descriptor). While testscenarios could use a decorator instead, thats undesirable as the test case

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-19 Thread Robert Collins
Robert Collins added the comment: Or anther way this could be done would be to make TestCase.__str__ call self.id(), and then __str__ never needs to be adjusted - id() or shortDescription are the only things to tweak. -- ___ Python tracker

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-19 Thread R. David Murray
R. David Murray added the comment: By descriptor I think you really mean it is a special method (ie: looked up on the class only, not on an instance). A descriptor is something else. This is a feature request and could only be implemented in 3.4. Assuming I'm understanding what you are

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-19 Thread Chris Jerdonek
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- nosy: +chris.jerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16288 ___ ___

[issue16288] TextTestResult uses TestCase.__str__() which isn't customisable (vs id() or shortDescription())

2012-10-19 Thread Robert Collins
Robert Collins added the comment: They aren't descriptors? They certainly aren't normal methods: class foo(object): ... def __str__(self): return foo ... f = foo() f.__str__ = lambda: bar str(f) 'foo' I *thought* the mechanism by which they can only be replaced by altering the class