def test_concat_empty_transform_zero_transform_trivial(self):
        # Build the transforms
        A = Transform(size_in=2, transform=0, size_out=2)
        B = Transform(size_in=2, transform=1, size_out=2)

        # Check that the test is correct
        expected = np.dot(B.full_transform(False, False),
                          A.full_transform(False, False))
        assert not np.any(expected), "Test broken"

        # Combine the transforms, this should return None to indicate that the
        # transform is empty.
        assert A.concat(B) is None
    def test_concat_empty_transform_mismatched_slicing(self):
        # Build the transforms
        A = Transform(size_in=1, transform=1, size_out=2, slice_out=[0])
        B = Transform(size_in=2, slice_in=[1], transform=1, size_out=1)

        # Check that the test is correct
        expected = np.dot(B.full_transform(False, False),
                          A.full_transform(False, False))
        assert not np.any(expected), "Test broken"

        # Combine the transforms, this should return None to indicate that the
        # transform is empty.
        assert A.concat(B) is None
    def test_concat_empty_transform_zero_transform_trivial(self):
        # Build the transforms
        A = Transform(size_in=2, transform=0, size_out=2)
        B = Transform(size_in=2, transform=1, size_out=2)

        # Check that the test is correct
        expected = np.dot(B.full_transform(False, False),
                          A.full_transform(False, False))
        assert not np.any(expected), "Test broken"

        # Combine the transforms, this should return None to indicate that the
        # transform is empty.
        assert A.concat(B) is None
    def test_concat_empty_transform_mismatched_slicing(self):
        # Build the transforms
        A = Transform(size_in=1, transform=1, size_out=2, slice_out=[0])
        B = Transform(size_in=2, slice_in=[1], transform=1, size_out=1)

        # Check that the test is correct
        expected = np.dot(B.full_transform(False, False),
                          A.full_transform(False, False))
        assert not np.any(expected), "Test broken"

        # Combine the transforms, this should return None to indicate that the
        # transform is empty.
        assert A.concat(B) is None
    def test_concat(self, a_params, b_params):
        # Build the transforms
        A = Transform(size_in=8, size_out=8, **a_params)
        B = Transform(size_in=8, size_out=4, **b_params)

        # Compute the expected combined transform
        expected = np.dot(B.full_transform(False, False),
                          A.full_transform(False, False))

        # Combine the transforms
        C = A.concat(B)

        # Test
        assert np.array_equal(expected, C.full_transform(False, False))
    def test_concat(self, a_params, b_params):
        # Build the transforms
        A = Transform(size_in=8, size_out=8, **a_params)
        B = Transform(size_in=8, size_out=4, **b_params)

        # Compute the expected combined transform
        expected = np.dot(B.full_transform(False, False),
                          A.full_transform(False, False))

        # Combine the transforms
        C = A.concat(B)

        # Test
        assert np.array_equal(expected, C.full_transform(False, False))