'For one lowpass, bandpass, and highpass example filter, this test
checks two things:
- the mean squared error over the frequency domain of the unscaled
filter is smaller than the scaled filter (true for rectangular
window)
- the response of the scaled filter is exactly unity at the center
of the first passband'

def test_scaling(self):

    N = 11
    cases = [([0.5], True, (0, 1)), ([0.2, 0.6], False, (0.4, 1)), ([0.5], False, (1, 1))]
    for (cutoff, pass_zero, expected_response) in cases:
        h = firwin(N, cutoff, scale=False, pass_zero=pass_zero, window='ones')
        hs = firwin(N, cutoff, scale=True, pass_zero=pass_zero, window='ones')
        if (len(cutoff) == 1):
            if pass_zero:
                cutoff = ([0] + cutoff)
            else:
                cutoff = (cutoff + [1])
        assert_((self.mse(h, [cutoff]) < self.mse(hs, [cutoff])), 'least    squares    violation')
        self.check_response(hs, [expected_response], 1e-12)
