Skip to content

Add return type for tests #7327

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
May 12, 2025
Merged

Conversation

dstrain115
Copy link
Collaborator

  • Adds return type for tests as None.
  • Looking at Pass --disallow-untyped-defs flag to mypy. #4393, it occured we could automate a bunch of these errors with a simple script by adding "-> None" to tests.
  • At first, I thought this was ridiculous, but actually, this enables mypy to check the tests for typing errors, of which there are many.
  • These are the files that can be automatically changed that do not having typing errors.
  • The only changes are adding "-> None" to the test functions.

- Adds return type for tests as None.
- Looking at quantumlib#4393, it occured we could automate a bunch of these
errors with a simple script by adding "-> None" to tests.
- At first, I thought this was ridiculous, but actually, this enables
mypy to check the tests for typing errors, of which there are many.
- These are the files that can be automatically changed that do not
having typing errors.
- The only changes are adding "-> None" to the test functions.
@dstrain115 dstrain115 requested review from mrwojtek, vtomole and a team as code owners May 8, 2025 17:51
@dstrain115 dstrain115 requested a review from fdmalone May 8, 2025 17:51
@github-actions github-actions bot added the size: L 250< lines changed <1000 label May 8, 2025
Copy link

codecov bot commented May 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.67%. Comparing base (b136ae8) to head (f9f37c5).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7327      +/-   ##
==========================================
- Coverage   98.67%   98.67%   -0.01%     
==========================================
  Files        1111     1111              
  Lines       96811    96811              
==========================================
- Hits        95528    95524       -4     
- Misses       1283     1287       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@vtomole vtomole left a comment

Choose a reason for hiding this comment

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

I didn't look through every file: It is a lot of tests 😅, but if a script did this then I believe it's fine.

@vtomole
Copy link
Collaborator

vtomole commented May 9, 2025

Do we want to add this commit to https://github.com/quantumlib/Cirq/blob/main/.git-blame-ignore-revs?

@dstrain115 dstrain115 added this pull request to the merge queue May 12, 2025
Merged via the queue into quantumlib:main with commit d1e68b1 May 12, 2025
39 checks passed
@dstrain115 dstrain115 deleted the mypy_untyped_defs branch May 12, 2025 19:23
pavoljuhas added a commit to pavoljuhas/Cirq that referenced this pull request May 12, 2025
github-merge-queue bot pushed a commit that referenced this pull request May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants