Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-106368: Improve coverage reports for argument clinic#107693

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AlexWaygood merged 1 commit intopython:mainfromAlexWaygood:clinic-coverage
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes fromall 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
5 changes: 5 additions & 0 deletions.coveragerc
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,11 @@ exclude_lines =
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
raise AssertionError\(

# Empty bodies in protocols or abstract methods
^\s*def [a-zA-Z0-9_]+\(.*\)(\s*->.*)?:\s*\.\.\.(\s*#.*)?$
^\s*\.\.\.(\s*#.*)?$

.*# pragma: no cover
.*# pragma: no branch
Expand Down
11 changes: 7 additions & 4 deletionsTools/clinic/clinic.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -469,18 +469,18 @@ class Language(metaclass=abc.ABCMeta):
checksum_line = ""

def __init__(self, filename: str) -> None:
pass
...

@abc.abstractmethod
def render(
self,
clinic: Clinic | None,
signatures: Iterable[Module | Class | Function]
) -> str:
pass
...

def parse_line(self, line: str) -> None:
pass
...

def validate(self) -> None:
def assert_only_one(
Expand DownExpand Up@@ -2862,6 +2862,9 @@ def __getattr__(self, attr):
f"Note: accessing self.function inside converter_init is disallowed!"
)
return super().__getattr__(attr)
# this branch is just here for coverage reporting
else: # pragma: no cover
pass

def converter_init(self) -> None:
pass
Expand DownExpand Up@@ -3990,7 +3993,7 @@ def correct_name_for_self(
return "void *", "null"
if f.kind in (CLASS_METHOD, METHOD_NEW):
return "PyTypeObject *", "type"
raiseRuntimeError("Unhandled type of function f:" + repr(f.kind))
raiseAssertionError(f"Unhandled type of function f:{f.kind!r}")

def required_type_for_self_for_parser(
f: Function
Expand Down
10 changes: 8 additions & 2 deletionsTools/clinic/cpp.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -178,11 +178,17 @@ def pop_stack() -> TokenAndCondition:
if self.verbose:
print(self.status())

if __name__ == '__main__':
for filename in sys.argv[1:]:

def _main(filenames: list[str] | None = None) -> None:
filenames = filenames or sys.argv[1:]
for filename in filenames:
with open(filename) as f:
cpp = Monitor(filename, verbose=True)
print()
print(filename)
for line_number, line in enumerate(f.read().split('\n'), 1):
cpp.writeline(line)


if __name__ == '__main__':
_main()

[8]ページ先頭

©2009-2025 Movatter.jp