Back to index

python3.2  3.2.2
Public Member Functions
distutils.tests.test_version.VersionTestCase Class Reference

List of all members.

Public Member Functions

def test_prerelease
def test_cmp_strict
def test_cmp

Detailed Description

Definition at line 7 of file test_version.py.


Member Function Documentation

Definition at line 50 of file test_version.py.

00050 
00051     def test_cmp(self):
00052         versions = (('1.5.1', '1.5.2b2', -1),
00053                     ('161', '3.10a', 1),
00054                     ('8.02', '8.02', 0),
00055                     ('3.4j', '1996.07.12', -1),
00056                     ('3.2.pl0', '3.1.1.6', 1),
00057                     ('2g6', '11g', -1),
00058                     ('0.960923', '2.2beta29', -1),
00059                     ('1.13++', '5.5.kw', -1))
00060 
00061 
00062         for v1, v2, wanted in versions:
00063             res = LooseVersion(v1)._cmp(LooseVersion(v2))
00064             self.assertEqual(res, wanted,
00065                              'cmp(%s, %s) should be %s, got %s' %
00066                              (v1, v2, wanted, res))

Here is the call graph for this function:

Definition at line 18 of file test_version.py.

00018 
00019     def test_cmp_strict(self):
00020         versions = (('1.5.1', '1.5.2b2', -1),
00021                     ('161', '3.10a', ValueError),
00022                     ('8.02', '8.02', 0),
00023                     ('3.4j', '1996.07.12', ValueError),
00024                     ('3.2.pl0', '3.1.1.6', ValueError),
00025                     ('2g6', '11g', ValueError),
00026                     ('0.9', '2.2', -1),
00027                     ('1.2.1', '1.2', 1),
00028                     ('1.1', '1.2.2', -1),
00029                     ('1.2', '1.1', 1),
00030                     ('1.2.1', '1.2.2', -1),
00031                     ('1.2.2', '1.2', 1),
00032                     ('1.2', '1.2.2', -1),
00033                     ('0.4.0', '0.4', 0),
00034                     ('1.13++', '5.5.kw', ValueError))
00035 
00036         for v1, v2, wanted in versions:
00037             try:
00038                 res = StrictVersion(v1)._cmp(StrictVersion(v2))
00039             except ValueError:
00040                 if wanted is ValueError:
00041                     continue
00042                 else:
00043                     raise AssertionError(("cmp(%s, %s) "
00044                                           "shouldn't raise ValueError")
00045                                             % (v1, v2))
00046             self.assertEqual(res, wanted,
00047                              'cmp(%s, %s) should be %s, got %s' %
00048                              (v1, v2, wanted, res))
00049 

Here is the call graph for this function:

Definition at line 9 of file test_version.py.

00009 
00010     def test_prerelease(self):
00011         version = StrictVersion('1.2.3a1')
00012         self.assertEqual(version.version, (1, 2, 3))
00013         self.assertEqual(version.prerelease, ('a', 1))
00014         self.assertEqual(str(version), '1.2.3a1')
00015 
00016         version = StrictVersion('1.2.0')
00017         self.assertEqual(str(version), '1.2')

Here is the call graph for this function:


The documentation for this class was generated from the following file: