Skip to content

Commit

Permalink
Fix LSP violations in test files (#18362)
Browse files Browse the repository at this point in the history
Extracted from #18356
  • Loading branch information
cdce8p authored Dec 29, 2024
1 parent 9463929 commit 3433a0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions mypy/test/test_find_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ class FakeFSCache(FileSystemCache):
def __init__(self, files: set[str]) -> None:
self.files = {os.path.abspath(f) for f in files}

def isfile(self, file: str) -> bool:
return file in self.files
def isfile(self, path: str) -> bool:
return path in self.files

def isdir(self, dir: str) -> bool:
if not dir.endswith(os.sep):
dir += os.sep
return any(f.startswith(dir) for f in self.files)
def isdir(self, path: str) -> bool:
if not path.endswith(os.sep):
path += os.sep
return any(f.startswith(path) for f in self.files)

def listdir(self, dir: str) -> list[str]:
if not dir.endswith(os.sep):
dir += os.sep
return list({f[len(dir) :].split(os.sep)[0] for f in self.files if f.startswith(dir)})
def listdir(self, path: str) -> list[str]:
if not path.endswith(os.sep):
path += os.sep
return list({f[len(path) :].split(os.sep)[0] for f in self.files if f.startswith(path)})

def init_under_package_root(self, file: str) -> bool:
def init_under_package_root(self, path: str) -> bool:
return False


Expand Down
4 changes: 2 additions & 2 deletions mypy/test/testpep561.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class PEP561Suite(DataSuite):
files = ["pep561.test"]
base_path = "."

def run_case(self, test_case: DataDrivenTestCase) -> None:
test_pep561(test_case)
def run_case(self, testcase: DataDrivenTestCase) -> None:
test_pep561(testcase)


@contextmanager
Expand Down

0 comments on commit 3433a0e

Please sign in to comment.