def test_combine_unknown_filter(self):
        # Create the ingoing reception parameters
        reception_params_a = model.ReceptionParameters(nengo.Lowpass(0.05), 1)

        # Create the outgoing reception parameters
        reception_params_b = model.ReceptionParameters(mock.Mock(), 1)

        # Combine the parameter each way round
        for a, b in ((reception_params_a, reception_params_b),
                     (reception_params_a, reception_params_b)):
            with pytest.raises(NotImplementedError):
                new_rps = model_utils._combine_reception_params(a, b)
    def test_combine_unknown_filter(self):
        # Create the ingoing reception parameters
        reception_params_a = model.ReceptionParameters(nengo.Lowpass(0.05), 1)

        # Create the outgoing reception parameters
        reception_params_b = model.ReceptionParameters(mock.Mock(), 1)

        # Combine the parameter each way round
        for a, b in ((reception_params_a, reception_params_b),
                     (reception_params_a, reception_params_b)):
            with pytest.raises(NotImplementedError):
                new_rps = model_utils._combine_reception_params(a, b)
    def test_combine_none_and_lowpass_filter(self):
        # Create the ingoing reception parameters
        reception_params_a = model.ReceptionParameters(nengo.Lowpass(0.05), 1)

        # Create the outgoing reception parameters
        reception_params_b = model.ReceptionParameters(None, 3)

        # Combine the parameter each way round
        for a, b in ((reception_params_a, reception_params_b),
                     (reception_params_a, reception_params_b)):
            new_rps = model_utils._combine_reception_params(a, b)

            # Check filter type
            assert new_rps.filter == reception_params_a.filter

            # Check width is the width of the receiving item
            assert new_rps.width == b.width
    def test_combine_none_and_lowpass_filter(self):
        # Create the ingoing reception parameters
        reception_params_a = model.ReceptionParameters(nengo.Lowpass(0.05), 1)

        # Create the outgoing reception parameters
        reception_params_b = model.ReceptionParameters(None, 3)

        # Combine the parameter each way round
        for a, b in ((reception_params_a, reception_params_b),
                     (reception_params_a, reception_params_b)):
            new_rps = model_utils._combine_reception_params(a, b)

            # Check filter type
            assert new_rps.filter == reception_params_a.filter

            # Check width is the width of the receiving item
            assert new_rps.width == b.width
    def test_combine_linear_and_linear_filter(self):
        # Create the ingoing reception parameters
        reception_params_a = model.ReceptionParameters(nengo.Lowpass(0.05), 1)

        # Create the outgoing reception parameters
        reception_params_b = model.ReceptionParameters(nengo.Lowpass(0.01), 5)

        # Combine the parameter each way round
        for a, b in ((reception_params_a, reception_params_b),
                     (reception_params_a, reception_params_b)):
            new_rps = model_utils._combine_reception_params(a, b)

            # Check filter type
            synapse = new_rps.filter
            assert synapse.num == [1]
            assert np.all(synapse.den == [0.05 * 0.01, 0.05 + 0.01, 1])

            # Check width is the width of the receiving item
            assert new_rps.width == b.width
    def test_combine_linear_and_linear_filter(self):
        # Create the ingoing reception parameters
        reception_params_a = model.ReceptionParameters(nengo.Lowpass(0.05), 1)

        # Create the outgoing reception parameters
        reception_params_b = model.ReceptionParameters(nengo.Lowpass(0.01), 5)

        # Combine the parameter each way round
        for a, b in ((reception_params_a, reception_params_b),
                     (reception_params_a, reception_params_b)):
            new_rps = model_utils._combine_reception_params(a, b)

            # Check filter type
            synapse = new_rps.filter
            assert synapse.num == [1]
            assert np.all(synapse.den == [0.05 * 0.01, 0.05 + 0.01, 1])

            # Check width is the width of the receiving item
            assert new_rps.width == b.width