Skip to content

Better-support mypy strict equality flag#8799

Merged
sydney-runkle merged 3 commits intomainfrom
dmontagu/strict-equality-type-checking
Feb 13, 2024
Merged

Better-support mypy strict equality flag#8799
sydney-runkle merged 3 commits intomainfrom
dmontagu/strict-equality-type-checking

Conversation

@dmontagu
Copy link
Copy Markdown
Contributor

Closes #8773

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 13, 2024

CodSpeed Performance Report

Merging #8799 will not alter performance

Comparing dmontagu/strict-equality-type-checking (d15cbcd) with main (14ce997)

Summary

✅ 10 untouched benchmarks

Copy link
Copy Markdown
Contributor

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

Approved, assuming tests pass

@sydney-runkle sydney-runkle added relnotes-fix Used for bugfixes. topic-type checking Related to type checking labels Feb 13, 2024
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 13, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: d15cbcd
Status: ✅  Deploy successful!
Preview URL: https://1271a568.pydantic-docs2.pages.dev
Branch Preview URL: https://dmontagu-strict-equality-typ.pydantic-docs2.pages.dev

View logs

Comment thread tests/mypy/test_mypy.py
existing_output_code = test_config.existing.output_path.read_text()
print(f'Comparing output with {test_config.existing.output_path}')
else:
print('Expecting no mypy errors')
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wasted some time confused by the lack of this message

Comment thread tests/mypy/test_mypy.py
Comment on lines +208 to +210
print('**** Merged Output ****')
print(merged_output)
print('***********************')
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this was helpful for debugging, and I don't see much reason not to include it

Comment thread tests/mypy/test_mypy.py
continue
try:
line_number, message = line.split(':', maxsplit=1)
line_number, message = re.split(r':(?:\d+:)?', line, maxsplit=1)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if this is just a python 3.12 thing, but I was running into an issue where the messages had two numbers, like, 9:7: error: Non-overlapping equality check (left operand type: "User", right operand type: "Literal['test']") [comparison-overlap]. I think the second number is the character index. Considering this happened for me locally but I don't think it does in CI, it seems best to just prepare for it to be present in some cases and not others and split that off like this if present.

@sydney-runkle sydney-runkle merged commit 3c6bddb into main Feb 13, 2024
@sydney-runkle sydney-runkle deleted the dmontagu/strict-equality-type-checking branch February 13, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotes-fix Used for bugfixes. topic-type checking Related to type checking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mypy pydantic plugin comparaison no error

2 participants