Skip to content

Fix LSP violations in test files #18362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Comment on lines -26 to +27
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#18356 changed the superclass implementation instead. However as this is the only violation, I'm not sure that's necessary here.

mypy/mypy/test/data.py

Lines 818 to 820 in d79d89e

@abstractmethod
def run_case(self, testcase: DataDrivenTestCase) -> None:
raise NotImplementedError



@contextmanager
Expand Down
Loading