Exemple #1
0
    def testCollectData(self):
        self.detector.exposure_time = 2.2
        self.detector.collectData()

        calls = [call(4, True)]
        self.zebra.setSoftInput.assert_has_calls(calls)
        self.assertEqual(self.zebra.setSoftInput.call_count, len(calls))

        sleep(0.1 + 0.01)

        calls.append(call(4, False))
        self.zebra.setSoftInput.assert_has_calls(calls)
        self.assertEqual(self.zebra.setSoftInput.call_count, len(calls))
Exemple #2
0
    def testClose(self):
        self.beamline.getValue.return_value = '3'

        result = self.shclose()

        calls = [
            call("Top", "-PS-SHTR-02:CON", 2),
            call("Top", "-PS-SHTR-02:CON", 1)
        ]
        self.beamline.setValue.assert_has_calls(calls)
        self.beamline.getValue.assert_called_with(None, "Top",
                                                  "-PS-SHTR-02:STA")

        self.assertEqual(' -> EH Shutter Closed.', result)
Exemple #3
0
    def testOpen(self):
        self.beamline.getValue.return_value = '1'

        result = self.shopen()

        calls = [
            call("Top", "-PS-SHTR-02:CON", 2),
            call("Top", "-PS-SHTR-02:CON", 0)
        ]
        self.beamline.setValue.assert_has_calls(calls)
        self.beamline.getValue.assert_called_with(None, "Top",
                                                  "-PS-SHTR-02:STA")

        self.assertEqual(' -> EH Shutter Open.', result)
Exemple #4
0
    def testPrepareForCollection(self):
        # Note: this test takes over 5 seconds to run, due to the sleeps in prepareForCollection.
        #self.zebra.isSysStatSet.side_effect = lambda x: {self.detector.notReadyInput: 0}[x]
        returnValues = [
            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
            1, 1, 1, 1, 1, 1, 0
        ]

        self.zebra.isSysStatSet.side_effect = returnValues
        self.detector.prepareForCollection()

        calls = [call(self.detector.notReadyInput)] * len(returnValues)
        self.zebra.isSysStatSet.assert_has_calls(calls)
        self.assertEqual(self.zebra.isSysStatSet.call_count, len(returnValues))