Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
test_isfile.py39 linesDownload Raw Back to tests
1import os
2import sys
3from pathlib import Path
4
5import pytest
6
7import numpy as np
8from numpy.testing import assert_
9
10ROOT = Path(np.__file__).parents[0]
11FILES = [
12    ROOT / "py.typed",
13    ROOT / "__init__.pyi",
14    ROOT / "ctypeslib" / "__init__.pyi",
15    ROOT / "_core" / "__init__.pyi",
16    ROOT / "f2py" / "__init__.pyi",
17    ROOT / "fft" / "__init__.pyi",
18    ROOT / "lib" / "__init__.pyi",
19    ROOT / "linalg" / "__init__.pyi",
20    ROOT / "ma" / "__init__.pyi",
21    ROOT / "matrixlib" / "__init__.pyi",
22    ROOT / "polynomial" / "__init__.pyi",
23    ROOT / "random" / "__init__.pyi",
24    ROOT / "testing" / "__init__.pyi",
25]
26if sys.version_info < (3, 12):
27    FILES += [ROOT / "distutils" / "__init__.pyi"]
28
29
30@pytest.mark.thread_unsafe(
31    reason="os.path has a thread-safety bug (python/cpython#140054). "
32           "Expected to only be a problem in 3.14.0"
33)
34class TestIsFile:
35    def test_isfile(self):
36        """Test if all ``.pyi`` files are properly installed."""
37        for file in FILES:
38            assert_(os.path.isfile(file))
39 
codekingpro/portable-devtools · Team Ai