class TestGdaHardwareMonitor(unittest.TestCase):

    def setUp(self):
        dummy = createDummyAxes(['a', 'b', 'c', 'd', 'e', 'f'])
        self.grp = ScannableGroup('grp', dummy)
        self.diffhw = DiffractometerScannableGroup('sixc', MockDiffcalc(6),
                                                   self.grp)
        self.energyhw = MockMotor()
        self.hardware = ScannableHardwareAdapter(self.diffhw,
                                                       self.energyhw)

    def test__init__Andget_axes_names(self):
        self.assertEquals(self.hardware.get_axes_names(),
                          ('a', 'b', 'c', 'd', 'e', 'f'))

    def testGetPosition(self):
        self.diffhw.asynchronousMoveTo((1, 2, 3, 4, 5, 6))
        self.assertEqual(self.hardware.get_position(),
                         [1.0, 2.0, 3.0, 4.0, 5.0, 6.0])

    def testGetEnergy(self):
        self.energyhw.asynchronousMoveTo(1.0)
        self.assertEqual(self.hardware.get_energy(), 1.0)

    def testGetWavelength(self):
        self.energyhw.asynchronousMoveTo(1.0)
        self.assertEqual(self.hardware.get_wavelength(), 12.39842 / 1.0)
Example #2
0
 def setup_method(self):
     dummy = createDummyAxes(['a', 'b', 'c', 'd', 'e', 'f'])
     self.grp = ScannableGroup('grp', dummy)
     self.diffhw = DiffractometerScannableGroup('sixc', MockDiffcalc(6),
                                                self.grp)
     self.energyhw = MockMotor()
     self.hardware = ScannableHardwareAdapter(self.diffhw, self.energyhw)