Ejemplo n.º 1
0
 def test_get_2(self):
     la = LinearAdjustor()
     config = {'parent':self.get_fake_ion(100),
               'name':'linear_adjustor',
                'multiplier':2.0}
     la.configure(config)
     value = la.get()
     if value != 200.0:
         self.fail('wrong value returned from get. Value returned: ' 
                   + str(value))
Ejemplo n.º 2
0
 def test_get_with_just_offset_1(self):
     la = LinearAdjustor()
     config = {'parent':self.get_fake_ion(1),
               'name':'linear_adjustor',                  
               'offset':25.0}
     la.configure(config)
     value = la.get()
     if value != 26:
         self.fail('wrong value returned from get. Value returned: ' 
                   + str(value))
Ejemplo n.º 3
0
    def test_get_3(self):
        la = LinearAdjustor()
        random_multiplier = random.uniform(1.0,100.00)

        config = {'parent':self.get_fake_ion(100),'name':'linear_adjustor',
                  'multiplier':random_multiplier}
        la.configure(config)
        value = la.get()
        if value != 100*random_multiplier:
            self.fail('wrong value returned from get. Value returned: ' 
                      + str(value) + '\n' +
                      'Multipler: ' + str(random_multiplier))
Ejemplo n.º 4
0
 def test_set_with_offset_2(self):
     random_offset = random.uniform(1.0,100.00)
     la = LinearAdjustor()
     config = {'parent':self.get_fake_ion(1),
               'name':'linear_adjustor',
               'multiplier':2.0,
               'offset':random_offset}
     la.configure(config)
     la.set(23.3)
     value = float('%.1f' % la.get())        
     if value != 23.3:
         self.fail('wrong value returned from get. Value returned: ' + str(value))
Ejemplo n.º 5
0
 def test_set_with_offset_1(self):
     la = LinearAdjustor()
     config = {'parent':self.get_fake_ion(1),
               'name':'linear_adjustor',
               'multiplier':2.0,
               'offset':25}
     la.configure(config)
     la.set(200)
     value = la.get()
     if value != 200.0:
         self.fail('wrong value returned from get. Value returned: ' 
                    + str(value))