Package rubacon :: Package generators :: Module test_variable_generator
[hide private]
[frames] | no frames]

Source Code for Module rubacon.generators.test_variable_generator

 1  #!/usr/bin/env python 
 2  # encoding: utf-8 
 3  """ 
 4  test_variable_generator.py 
 5   
 6  Created by Sebastian Höhn on 2008-01-29. 
 7  Copyright (c) 2008 __MyCompanyName__. All rights reserved. 
 8  """ 
 9   
10  # from VariableGenerator import VariableGenerator 
11  from VariableGenerator import * 
12  import sys 
13   
14 -class TestVariableGenerator(object):
15
16 - def test_generator(self):
17 """Test generation of unique variables. 18 19 We need to check if it goes up to the two char 20 variables, too. 21 """ 22 uv = unique_variables() 23 assert (uv.next() == 'A') 24 # print >> sys.stderr , uv.next() 25 assert (uv.next() == 'B') 26 assert (uv.next() != 'D') 27 for i in range(1,26): 28 uv.next() 29 # print >> sys.stderr , uv.next() 30 assert (uv.next() == 'BC')
31 32 # Verify the reset button 33 #cdl.reset() 34 #assert (cdl.getNext() == 'A') 35 36 # TODO: Fix the Singleton if needed! 37 # Verify the Singleton pattern 38 #cdl2 = VariableGenerator() 39 #a = cdl2.getNext() 40 #print(a) 41 #assert (a == 'B') 42 #assert (cdl.getNext() == 'C') 43