M.-A. Lemburg wrote: > Kevin Butler wrote: > > from unittest.assertions import * > > That's bad style (at least for modules which don't only include > constants). Why would you want to enable this ? :-) - In general, if you provide a submodule, users can do 'from unittest import assertions' or 'import unittest.assertions as test' or some such. Just having a grundle of top-level symbols in a module is less convenient than appropriate grouping into submodules. - The Style Guide suggests prefixing methods that are intended for use with 'import *', and these functions are 'test*' or 'assert*'... - For test code, I tend to be a bit more liberal with 'import *', because in general, test code is pretty clear about what it is exercising. - The assertion methods are very independent of the other TestCase methods, and can be very useful for non-TestCase methods. This low coupling/high cohesion suggests organizing them together, but currently there's no convenient way to get at them separately. And since the methods really have little to do with an object instance, I find the 'self.assert*' construct distracting, although I like self.* in most cases. kb
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4