mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:30:26 +08:00
Revert D25977352: [pytorch][PR] Refactor mypy configs list into editor-friendly wrapper
Test Plan: revert-hammer
Differential Revision:
D25977352 (73dffc8452
)
Original commit changeset: 4b3a5e8a9071
fbshipit-source-id: a0383ea4158f54be6f128b9ddb2cd12fc3a3ea53
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ffc8a26991
commit
5c1c858ca8
@ -6,7 +6,6 @@ from torch.testing._internal.common_utils import \
|
||||
(TestCase, make_tensor, run_tests, slowTest)
|
||||
from torch.testing._internal.common_device_type import \
|
||||
(instantiate_device_type_tests, onlyCUDA, onlyOnCPUAndCUDA, dtypes)
|
||||
from torch.testing._internal import mypy_wrapper
|
||||
|
||||
# For testing TestCase methods and torch.testing functions
|
||||
class TestTesting(TestCase):
|
||||
@ -488,61 +487,5 @@ if __name__ == '__main__':
|
||||
|
||||
instantiate_device_type_tests(TestTesting, globals())
|
||||
|
||||
|
||||
class TestMypyWrapper(TestCase):
|
||||
def test_glob(self):
|
||||
# can match individual files
|
||||
self.assertTrue(mypy_wrapper.glob(
|
||||
pattern='test/test_torch.py',
|
||||
filename='test/test_torch.py',
|
||||
))
|
||||
self.assertFalse(mypy_wrapper.glob(
|
||||
pattern='test/test_torch.py',
|
||||
filename='test/test_testing.py',
|
||||
))
|
||||
|
||||
# dir matters
|
||||
self.assertFalse(mypy_wrapper.glob(
|
||||
pattern='tools/codegen/utils.py',
|
||||
filename='torch/nn/modules.py',
|
||||
))
|
||||
self.assertTrue(mypy_wrapper.glob(
|
||||
pattern='setup.py',
|
||||
filename='setup.py'
|
||||
))
|
||||
self.assertFalse(mypy_wrapper.glob(
|
||||
pattern='setup.py',
|
||||
filename='foo/setup.py'
|
||||
))
|
||||
self.assertTrue(mypy_wrapper.glob(
|
||||
pattern='foo/setup.py',
|
||||
filename='foo/setup.py'
|
||||
))
|
||||
|
||||
# can match dirs
|
||||
self.assertTrue(mypy_wrapper.glob(
|
||||
pattern='torch',
|
||||
filename='torch/random.py',
|
||||
))
|
||||
self.assertTrue(mypy_wrapper.glob(
|
||||
pattern='torch',
|
||||
filename='torch/nn/cpp.py',
|
||||
))
|
||||
self.assertFalse(mypy_wrapper.glob(
|
||||
pattern='torch',
|
||||
filename='tools/fast_nvcc/fast_nvcc.py',
|
||||
))
|
||||
|
||||
# can match wildcards
|
||||
self.assertTrue(mypy_wrapper.glob(
|
||||
pattern='tools/autograd/*.py',
|
||||
filename='tools/autograd/gen_autograd.py',
|
||||
))
|
||||
self.assertFalse(mypy_wrapper.glob(
|
||||
pattern='tools/autograd/*.py',
|
||||
filename='tools/autograd/deprecated.yaml',
|
||||
))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run_tests()
|
||||
|
Reference in New Issue
Block a user