Back to index

moin  1.9.0~rc2
Public Member Functions
test_util.TestUtil Class Reference

List of all members.

Public Member Functions

def testRangeList
def testRandomString

Detailed Description

Definition at line 11 of file test_util.py.


Member Function Documentation

util.random_string: test randomness and length 

Definition at line 43 of file test_util.py.

00043 
00044     def testRandomString(self):
00045         """ util.random_string: test randomness and length """
00046         length = 8
00047         result1 = util.random_string(length)
00048         result2 = util.random_string(length)
00049         assert result1 != result2, ('Expected different random strings, but got "%(result1)s" and "%(result2)s"') % locals()
00050 
00051         result = len(util.random_string(length))
00052         expected = length
00053         assert result == expected, ('Expected length "%(expected)s" but got "%(result)s"') % locals()

util.rangelist: test correct function for misc. input values 

Definition at line 13 of file test_util.py.

00013 
00014     def testRangeList(self):
00015         """ util.rangelist: test correct function for misc. input values """
00016         result = util.rangelist([])
00017         expected = ''
00018         assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
00019 
00020         result = util.rangelist([42])
00021         expected = '42'
00022         assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
00023 
00024         result = util.rangelist([42, 23])
00025         expected = '23,42'
00026         assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
00027 
00028         result = util.rangelist([1, 2, 3, 4, 5])
00029         expected = '1-5'
00030         assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
00031 
00032         result = util.rangelist([2, 5, 3])
00033         expected = '2-3,5'
00034         assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
00035 
00036         result = util.rangelist([2, 3, 5, 6])
00037         expected = '2-3,5-6'
00038         assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
00039 
00040         result = util.rangelist([2, 3, 5, 6, 23, 100, 101, 102, 104])
00041         expected = '2-3,5-6,23,100-102,104'
00042         assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()


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