| 12345678910111213141516171819202122232425262728293031 | """Test possibility of patching fftpack with pyfftw.No module source outside of scipy.fftpack should contain an import ofthe form `from scipy.fftpack import ...`, so that a simple replacementof scipy.fftpack by the corresponding fftw interface completely swapsthe two FFT implementations.Because this simply inspects source files, we only need to run the teston one version of Python."""from pathlib import Pathimport reimport tokenizefrom numpy.testing import assert_import scipyclass TestFFTPackImport:    def test_fftpack_import(self):        base = Path(scipy.__file__).parent        regexp = r"\s*from.+\.fftpack import .*\n"        for path in base.rglob("*.py"):            if base / "fftpack" in path.parents:                continue            # use tokenize to auto-detect encoding on systems where no            # default encoding is defined (e.g., LANG='C')            with tokenize.open(str(path)) as file:                assert_(all(not re.fullmatch(regexp, line)                            for line in file),                        "{0} contains an import from fftpack".format(path))
 |