def test_adding_faulty_non_default_works(self): t = LayoutTable.from_rows([["BAD2", "faulty", 0, 0, True]]) self.b.layout.put_value(t) assert list(self.b.configure.meta.defaults["detectors"].rows()) == [ [True, "FAST", "fast", 0.0, 1], [True, "SLOW", "slow", 0.0, 1], [False, "BAD2", "faulty", 0.0, 1], ] self.b.configure(self.make_generator(), self.tmpdir)
def test_adding_faulty_fails(self): t = LayoutTable.from_rows([["BAD", "faulty", 0, 0, True]]) self.b.layout.put_value(t) assert list(self.b.configure.meta.defaults["detectors"].rows()) == [ [True, "FAST", "fast", 0.0, 1], [True, "SLOW", "slow", 0.0, 1], [True, "BAD", "faulty", 0.0, 1], ] with self.assertRaises(BadValueError) as cm: self.b.configure(self.make_generator(), self.tmpdir) assert str(cm.exception) == ( "Detector BAD was faulty at init and is unusable. " "If the detector is now working please restart Malcolm" ) self.b.configure( self.make_generator(), self.tmpdir, detectors=DetectorTable.from_rows([(False, "BAD", "faulty", 0.0, 1)]), ) self.b.reset() t = LayoutTable.from_rows([["BAD", "faulty", 0, 0, False]]) self.b.layout.put_value(t) self.test_init() self.b.configure(self.make_generator(), self.tmpdir)
def test_pcap_visible(self): t = LayoutTable.from_rows([["PCAP", "", 0, 0, True]]) block = self.process.block_view("P") assert "attributesToCapture" not in block block.layout.put_value(t) assert block.attributesToCapture.meta.tags == ["widget:table"]