コード例 #1
0
 def test_get_status_getAnalogIn_fails(self):
     spec = AvsFiberSpectrograph()
     self.patch.return_value.AVS_GetAnalogIn.side_effect = None
     self.patch.return_value.AVS_GetAnalogIn.return_value = (
         AvsReturnCode.ERR_TIMEOUT.value)
     with pytest.raises(AvsReturnError, match="GetAnalogIn.*ERR_TIMEOUT"):
         spec.get_status()
コード例 #2
0
 def test_get_status_getVersionInfo_fails(self):
     spec = AvsFiberSpectrograph()
     self.patch.return_value.AVS_GetVersionInfo.side_effect = None
     self.patch.return_value.AVS_GetVersionInfo.return_value = (
         AvsReturnCode.ERR_DEVICE_NOT_FOUND.value)
     with pytest.raises(AvsReturnError,
                        match="GetVersionInfo.*ERR_DEVICE_NOT_FOUND"):
         spec.get_status()
コード例 #3
0
 def test_get_status_getParameter_fails(self):
     spec = AvsFiberSpectrograph()
     self.patch.return_value.AVS_GetParameter.side_effect = None
     self.patch.return_value.AVS_GetParameter.return_value = (
         AvsReturnCode.ERR_INVALID_DEVICE_ID.value)
     with pytest.raises(AvsReturnError,
                        match="GetParameter.*ERR_INVALID_DEVICE_ID"):
         spec.get_status()
コード例 #4
0
    def test_get_status(self):
        spec = AvsFiberSpectrograph()
        status = spec.get_status()
        assert status.fpga_version == self.fpga_version
        assert status.firmware_version == self.firmware_version
        assert status.library_version == self.library_version
        assert status.n_pixels == self.n_pixels
        assert status.temperature_setpoint == self.temperature_setpoint
        np.testing.assert_allclose(status.temperature, self.temperature)
        assert status.config is None

        # Check that full=True returns a AvsDeviceConfig instead of None
        # (we're not worried about the contents of it here)
        status = spec.get_status(full=True)
        assert status.config is not None