def test_try_operation(self): apt = DummyPulseTemplate(duration=1, defined_channels={'a'}) npt = PulseTemplateStub(defined_channels={'a'}) self.assertIsInstance(try_operation(npt, '+', 6), ArithmeticPulseTemplate) self.assertIsInstance(try_operation(apt, '+', apt), ArithmeticAtomicPulseTemplate) self.assertIs(NotImplemented, try_operation(npt, '/', npt)) self.assertIs(NotImplemented, try_operation(npt, '//', 6))
def __truediv__(self, other): from qupulse.pulses.arithmetic_pulse_template import try_operation return try_operation(self, '/', other)
def __rmul__(self, other): from qupulse.pulses.arithmetic_pulse_template import try_operation return try_operation(other, '*', self)
def __radd__(self, other: ExpressionLike): from qupulse.pulses.arithmetic_pulse_template import try_operation return try_operation(other, '+', self)