def test_mul_inconsistent_dimension(self):
     """Multiply two transfer function matrices of incompatible sizes."""
     sys1 = TransferFunction([[[1., 2.], [4., 5.]], [[2., 5.], [4., 3.]]],
                             [[[6., 2.], [4., 1.]], [[6., 7.], [2., 4.]]])
     sys2 = TransferFunction([[[1.]], [[2.]], [[3.]]],
                             [[[4.]], [[5.]], [[6.]]])
     with pytest.raises(ValueError):
         sys1.__mul__(sys2)
     with pytest.raises(ValueError):
         sys2.__mul__(sys1)
     with pytest.raises(ValueError):
         sys1.__rmul__(sys2)
     with pytest.raises(ValueError):
         sys2.__rmul__(sys1)
    def test_size_mismatch(self):
        """Test size mismacht"""
        sys1 = ss2tf(rss(2, 2, 2))

        # Different number of inputs
        sys2 = ss2tf(rss(3, 1, 2))
        with pytest.raises(ValueError):
            TransferFunction.__add__(sys1, sys2)

        # Different number of outputs
        sys2 = ss2tf(rss(3, 2, 1))
        with pytest.raises(ValueError):
            TransferFunction.__add__(sys1, sys2)

        # Inputs and outputs don't match
        with pytest.raises(ValueError):
            TransferFunction.__mul__(sys2, sys1)

        # Feedback mismatch (MIMO not implemented)
        with pytest.raises(NotImplementedError):
            TransferFunction.feedback(sys2, sys1)