Changes between Version 16 and Version 17 of PythonGuidelines


Ignore:
Timestamp:
Apr 20, 2010 5:57:52 AM (14 years ago)
Author:
Chris Jerdonek
Comment:

Added unittest naming convention.

Legend:

Unmodified
Added
Removed
Modified
  • PythonGuidelines

    v16 v17  
    5050}}}
    5151 This keeps the ordering of lines the same when changing a `from` statement to an `import` statement, and vice versa.  This also makes it easer to see if both `from` and `import` statements are used to import from the same package (since the lines will be adjacent).  By "within a group," we mean in the PEP8 sense of grouping standard library imports separately from local application imports, etc.
     52 * When writing unit tests with the unittest module, unittest.TestCase classes should have names of the form ClassTest, where "Class" is the name of the class being tested.  Similarly, test methods should have names of the form test_method!__description, where "method" is the name of the method in the class being tested.  The double underscore after "method" is helpful because "method" may itself have underscores.  This style is used, for example, in the unit tests for Python's unittest module itself (e.g. see [http://svn.python.org/view/python/trunk/Lib/unittest/test/test_loader.py?revision=79464&view=markup here]).
    5253
    5354== Upgrading from Python 2.3 or Python 2.4 ==