Ejemplo n.º 1
0
    def test_t_stop_signal_emit_indirect(self):
        pulse = Pulse(t_start=1, duration=2)

        parameter_measure_t_stop = Parameter(set_cmd=None)
        pulse['t_stop'].connect(parameter_measure_t_stop, update=True)
        self.assertEqual(parameter_measure_t_stop(), 3)

        pulse.t_start = 2
        self.assertEqual(parameter_measure_t_stop(), 4)

        pulse.duration = 3
        self.assertEqual(parameter_measure_t_stop(), 5)
Ejemplo n.º 2
0
    def test_signal_emit(self):
        p = Pulse(t_start=1, t_stop=2)

        p2 = Pulse(duration=3)
        p['t_start'].connect(p2['t_start'], offset=5)
        self.assertEqual(p2.t_start, 6)
        self.assertEqual(p2.duration, 3)
        self.assertEqual(p2.t_stop, 9)

        p.t_start = 3
        self.assertEqual(p.t_stop, 4)
        self.assertEqual(p2.t_start, 8)
        self.assertEqual(p2.t_stop, 11)

        p2.t_start = 5
        self.assertEqual(p2.t_start, 5)
        self.assertEqual(p2.duration, 3)
        self.assertEqual(p2.t_stop, 8)

        # The signal connection remains even after changing its value
        p.t_start = 10
        self.assertEqual(p2.t_start, 15)
Ejemplo n.º 3
0
    def test_signal_copy(self):
        p = Pulse(t_start=1)

        p2 = Pulse()
        p['t_start'].connect(p2['t_start'])
        self.assertEqual(p2.t_start, 1)

        p3 = copy(p2)
        self.assertEqual(p3.t_start, 1)

        p4 = deepcopy(p2)
        self.assertEqual(p4.t_start, 1)

        p.t_start = 2
        self.assertEqual(p2.t_start, 2)
        self.assertEqual(p3.t_start, 1)
        self.assertEqual(p4.t_start, 1)