def test_delays_tdmprogram_with_several_spatial_modes(self): """Test that error is raised when calculating the delays of a TDM program with more than one spatial mode""" prog = TDMProgram(N=[1, 2]) with prog.context([0, np.pi / 2], [0, np.pi / 2]) as (p, q): ops.Sgate(4) | q[0] ops.Sgate(4) | q[2] ops.MeasureHomodyne(p[0]) | q[0] ops.MeasureHomodyne(p[1]) | q[1] with pytest.raises( NotImplementedError, match="Calculating delays for programs with more than one spatial mode is not implemented.", ): prog.get_delays()
def test_delays_tdmprogram_with_nested_loops(self): """Test that error is raised when calculating the delays of a TDM program with nested loops""" gate_args = [random_bs(8), random_bs(8)] # a program with nested delays prog = TDMProgram(N=4) with prog.context(*gate_args) as (p, q): ops.Sgate(0.4, 0) | q[3] ops.BSgate(p[0]) | (q[0], q[3]) ops.BSgate(p[1]) | (q[2], q[1]) ops.MeasureX | q[0] with pytest.raises( NotImplementedError, match="Calculating delays for programs with nested loops is not implemented.", ): prog.get_delays()