Back to index

moin  1.9.0~rc2
Public Member Functions
MoinMoin._tests.test_wikiutil.TestVersion Class Reference

List of all members.

Public Member Functions

def test_Version

Detailed Description

Definition at line 1043 of file test_wikiutil.py.


Member Function Documentation

Definition at line 1044 of file test_wikiutil.py.

01044 
01045     def test_Version(self):
01046         Version = wikiutil.Version
01047         # test properties
01048         assert Version(1, 2, 3).major == 1
01049         assert Version(1, 2, 3).minor == 2
01050         assert Version(1, 2, 3).release == 3
01051         assert Version(1, 2, 3, '4.5alpha6').additional == '4.5alpha6'
01052         # test Version init and Version to str conversion
01053         assert str(Version(1)) == "1.0.0"
01054         assert str(Version(1, 2)) == "1.2.0"
01055         assert str(Version(1, 2, 3)) == "1.2.3"
01056         assert str(Version(1, 2, 3, '4.5alpha6')) == "1.2.3-4.5alpha6"
01057         assert str(Version(version='1.2.3')) == "1.2.3"
01058         assert str(Version(version='1.2.3-4.5alpha6')) == "1.2.3-4.5alpha6"
01059         # test Version comparison, trivial cases
01060         assert Version() == Version()
01061         assert Version(1) == Version(1)
01062         assert Version(1, 2) == Version(1, 2)
01063         assert Version(1, 2, 3) == Version(1, 2, 3)
01064         assert Version(1, 2, 3, 'foo') == Version(1, 2, 3, 'foo')
01065         assert Version(1) != Version(2)
01066         assert Version(1, 2) != Version(1, 3)
01067         assert Version(1, 2, 3) != Version(1, 2, 4)
01068         assert Version(1, 2, 3, 'foo') != Version(1, 2, 3, 'bar')
01069         assert Version(1) < Version(2)
01070         assert Version(1, 2) < Version(1, 3)
01071         assert Version(1, 2, 3) < Version(1, 2, 4)
01072         assert Version(1, 2, 3, 'bar') < Version(1, 2, 3, 'foo')
01073         assert Version(2) > Version(1)
01074         assert Version(1, 3) > Version(1, 2)
01075         assert Version(1, 2, 4) > Version(1, 2, 3)
01076         assert Version(1, 2, 3, 'foo') > Version(1, 2, 3, 'bar')
01077         # test Version comparison, more delicate cases
01078         assert Version(1, 12) > Version(1, 9)
01079         assert Version(1, 12) > Version(1, 1, 2)
01080         assert Version(1, 0, 0, '0.0a2') > Version(1, 0, 0, '0.0a1')
01081         assert Version(1, 0, 0, '0.0b1') > Version(1, 0, 0, '0.0a9')
01082         assert Version(1, 0, 0, '0.0b2') > Version(1, 0, 0, '0.0b1')
01083         assert Version(1, 0, 0, '0.0c1') > Version(1, 0, 0, '0.0b9')
01084         assert Version(1, 0, 0, '1') > Version(1, 0, 0, '0.0c9')
01085         # test Version playing nice with tuples
01086         assert Version(1, 2, 3) == (1, 2, 3, '')
01087         assert Version(1, 2, 4) > (1, 2, 3)
01088 


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