def test_sim_string(): sim_camera = SimCamera() assert str(sim_camera) == 'Simulated Camera ({}) on None'.format(sim_camera.uid) sim_camera = SimCamera(name='Sim', port='/dev/ttyFAKE') assert str(sim_camera) == 'Sim ({}) on /dev/ttyFAKE'.format(sim_camera.uid)
def test_sim_file_extension(): sim_camera = SimCamera() assert sim_camera.file_extension == 'fits' sim_camera = SimCamera(file_extension='FIT') assert sim_camera.file_extension == 'FIT'
def test_sim_worse_focuser(): sim_camera = SimCamera(focuser='******') # Will log an error but raise no exceptions assert sim_camera.focuser is None
def test_sim_bad_focuser(): with pytest.raises((AttributeError, ImportError, NotFound)): SimCamera(focuser={'model': 'NOTAFOCUSER'})
def test_sim_passed_focuser(): sim_focuser = Focuser(port='/dev/ttyFAKE') sim_camera = SimCamera(focuser=sim_focuser) assert sim_camera.focuser is sim_focuser
def test_sim_create_focuser(): sim_camera = SimCamera(focuser={'model': 'simulator', 'focus_port': '/dev/ttyFAKE'}) assert isinstance(sim_camera.focuser, Focuser)
def test_sim_readout_time(): sim_camera = SimCamera() assert sim_camera.readout_time == 5.0 sim_camera = SimCamera(readout_time=2.0) assert sim_camera.readout_time == 2.0