René's URL Explorer Experiment


Title: Rewrite .test as .py · Issue #15326 · python/mypy · GitHub

Open Graph Title: Rewrite .test as .py · Issue #15326 · python/mypy

X Title: Rewrite .test as .py · Issue #15326 · python/mypy

Description: Many of us are using editors that handle Python code (syntax highlighting, symbol browsing). Would it be a good idea to restructure the .test data-files as Python files? I've been musing about it for a while, so hear me out, then let me ...

Open Graph Description: Many of us are using editors that handle Python code (syntax highlighting, symbol browsing). Would it be a good idea to restructure the .test data-files as Python files? I've been musing about it f...

X Description: Many of us are using editors that handle Python code (syntax highlighting, symbol browsing). Would it be a good idea to restructure the .test data-files as Python files? I've been musing about ...

Opengraph URL: https://github.com/python/mypy/issues/15326

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Rewrite .test as .py","articleBody":"Many of us are using editors that handle Python code (syntax highlighting, symbol browsing). Would it be a good idea to restructure the .test data-files as Python files?\r\n\r\nI've been musing about it for a while, so hear me out, then let me know if it's a stupid idea :)\r\n\r\nExample:\r\n\r\n```diff\r\n-[case testFoo]\r\n-s1: str = 42  # E: Incompatible types in assignment (expression has type \"int\", variable has type \"str\")\r\n+def test_foo():\r\n+  s1: str = 42  # E: Incompatible types in assignment (expression has type \"int\", variable has type \"str\")\r\n```\r\n\r\nTo clarify, this wouldn't be true Python code, i.e. it won't be fed directly to CPython or Mypy; rather, it'll be a Python-flavored data file — perhaps parsed by AST (if feasible and performant), but where the function bodies are passed to the current machinery as text.\r\n\r\nExtra qualifies like `# flags: --strict-optional` could be represented as decorators, e.g.\r\n```python\r\n@flags('--strict-optional')\r\ndef test_foo():\r\n   ...\r\n```\r\n\r\n`[case testFoo-xfail]` would become:\r\n```python\r\n@pytest.mark.xfail\r\ndef test_foo():\r\n   ...\r\n```\r\n\r\n`[out]` would become:\r\n```python\r\n@expected_output(\"\"\"\r\nmain:1: Incompatible types in assignment (expression has type \"int\", variable has type \"str\")\r\n\"\"\")\r\ndef test_foo():\r\n   ...\r\n```\r\n\r\n`[file a.py]` would become:\r\n```python\r\n@testcase\r\ndef test_foo():\r\n   ...  # main goes here\r\n\r\n\r\n@test_foo.file('a.py')\r\ndef test_foo():\r\n   ...  # a.py goes here\r\n```\r\n\r\nBenefits:\r\n- First-class support in IDEs, e.g. \r\n   ![image](https://github.com/python/mypy/assets/1186084/795910d1-5b9e-4ce1-9216-ad66a6acea18)\r\n   ![image](https://github.com/python/mypy/assets/1186084/fe24e6b6-1512-41d8-a50e-f3cbdd4451a1)\r\n- The disarray of testcase options, sections and modifiers could be formalized in a Pythonic syntax and a module that would document them, e.g. `from mypy.testcase import expected_output` and then\r\n   ```python\r\n   # mypy/testcase.py\r\n\r\n   def expected_output(output: str) -> Testcase:\r\n       \"\"\"Documentation goes here\"\"\"\r\n       ... \r\n   ````\r\n- Can use some Python tooling like Black\r\n- A more flexible representation than INI, while providing first-class editor experience (unlike, say, converting to YAML and putting the Python test cases into a multiline YAML block).\r\n- More natural for newcomers?\r\n\r\nCons:\r\n- Harder to implement?\r\n- Confusing that it's Python but not really?\r\n- Less natural to newcomers?\r\n","author":{"url":"https://github.com/ikonst","@type":"Person","name":"ikonst"},"datePublished":"2023-05-30T19:16:59Z","url":"https://github.com/python/mypy/issues/15326"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c3347759-b36a-3aea-8b03-ff65f1dfb51e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA2BE:182C25:BC53D9:FC5BBD:6B004E53
html-safe-nonce3e199d1d988fcd8d051d5acbcd1118116e5a9d1c96f8e74ea01d6b611c7d7741
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMkJFOjE4MkMyNTpCQzUzRDk6RkM1QkJEOjZCMDA0RTUzIiwidmlzaXRvcl9pZCI6IjQ4MzIyMzIyODU5Mjk0OTIwNTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac5a70d1b5c8c496a98dac9135dd14fec6b200360186121929f957ac674028e359
hovercard-subject-tagissue:1732838937
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/15326/issue_layout
twitter:imagehttps://opengraph.githubassets.com/544c7e319deb5851bd90cf67374f7d98b89bd99f8369ff306cb87ac5fdf4b061/python/mypy/issues/15326
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/544c7e319deb5851bd90cf67374f7d98b89bd99f8369ff306cb87ac5fdf4b061/python/mypy/issues/15326
og:image:altMany of us are using editors that handle Python code (syntax highlighting, symbol browsing). Would it be a good idea to restructure the .test data-files as Python files? I've been musing about it f...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameikonst
hostnamegithub.com
expected-hostnamegithub.com
Nonef420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb
turbo-cache-controlno-preview
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release26e00df917aba0f128135dc073ea0c5e33a70d40
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/15326#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F15326
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F15326
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/issues/15326
Reloadhttps://github.com/python/mypy/issues/15326
Reloadhttps://github.com/python/mypy/issues/15326
pythonhttps://github.com/python
mypyhttps://github.com/python/mypy
Codehttps://github.com/python/mypy
Issues2.7k (2.7k)https://github.com/python/mypy/issues
Pull requests546 (546)https://github.com/python/mypy/pulls
Actionshttps://github.com/python/mypy/actions
Projectshttps://github.com/python/mypy/projects
Wikihttps://github.com/python/mypy/wiki
Security and qualityhttps://github.com/python/mypy/security
Insightshttps://github.com/python/mypy/insights
https://github.com/python/mypy
Rewrite .test as .pyhttps://github.com/python/mypy/issues/15326#top
featurehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22feature%22
topic-developerIssues relevant to mypy developershttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-developer%22
topic-testshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-tests%22
https://github.com/ikonst
ikonsthttps://github.com/ikonst
on May 30, 2023https://github.com/python/mypy/issues/15326#issue-1732838937
https://private-user-images.githubusercontent.com/1186084/242070221-795910d1-5b9e-4ce1-9216-ad66a6acea18.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTUxODI0NjMsIm5iZiI6MTc5NTE4MjE2MywicGF0aCI6Ii8xMTg2MDg0LzI0MjA3MDIyMS03OTU5MTBkMS01YjllLTRjZTEtOTIxNi1hZDY2YTZhY2VhMTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MTEyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjExMjBUMTM0MjQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTI5YzA4ZGZhODU1MzE1ZWQwMDBiYTM3NTkzYzYxNzAzNDQ2NTFjMGM3MTBkZDMzNzkxMjM5YzA2M2I3ZGQwOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.bGz1oZCyFyFBZ10gyIvD2JWeqSDSEQczKC0QnB-tn-0
https://private-user-images.githubusercontent.com/1186084/242070276-fe24e6b6-1512-41d8-a50e-f3cbdd4451a1.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTUxODI0NjMsIm5iZiI6MTc5NTE4MjE2MywicGF0aCI6Ii8xMTg2MDg0LzI0MjA3MDI3Ni1mZTI0ZTZiNi0xNTEyLTQxZDgtYTUwZS1mM2NiZGQ0NDUxYTEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MTEyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjExMjBUMTM0MjQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWIxZTBmZWNmZDdkZDc0ODE5MjU1ZWNiMTQzOGU5ZDc2MzIyYzM3MTM1NmYyNmE4MDE3MGRjN2MwNjZiOTdiMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.PId00FOVEfhxUQmsNjPh4owccHwCdMD-jDmF8WmSy4s
ikonsthttps://github.com/ikonst
featurehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22feature%22
on May 30, 2023https://github.com/python/mypy/issues/15326#event-9382065695
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on May 31, 2023https://github.com/python/mypy/issues/15326#issuecomment-1569607939
mypyc/mypyc#959https://github.com/mypyc/mypyc/issues/959
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
on May 31, 2023https://github.com/python/mypy/issues/15326#issuecomment-1570348801
https://github.com/quora/pyanalyze/blob/8d0e9d4fcfa0c5875dd5ff93c6ec1ae188bf9738/pyanalyze/test_name_check_visitor.py#L174https://github.com/quora/pyanalyze/blob/8d0e9d4fcfa0c5875dd5ff93c6ec1ae188bf9738/pyanalyze/test_name_check_visitor.py#L174
https://github.com/ikonst
ikonsthttps://github.com/ikonst
on May 31, 2023https://github.com/python/mypy/issues/15326#issuecomment-1570424004
ichard26https://github.com/ichard26
topic-developerIssues relevant to mypy developershttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-developer%22
on Jun 7, 2023https://github.com/python/mypy/issues/15326#event-9460091097
https://github.com/KotlinIsland
KotlinIslandhttps://github.com/KotlinIsland
on Oct 8, 2023https://github.com/python/mypy/issues/15326#issuecomment-1751909418
@ikonsthttps://github.com/ikonst
https://private-user-images.githubusercontent.com/65446343/273424178-cc5e6a1f-f734-4ba2-b9e9-4f382c36f957.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTUxODI0NjQsIm5iZiI6MTc5NTE4MjE2NCwicGF0aCI6Ii82NTQ0NjM0My8yNzM0MjQxNzgtY2M1ZTZhMWYtZjczNC00YmEyLWI5ZTktNGYzODJjMzZmOTU3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTIwVDEzNDI0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ1M2UwMWUyNzlkMjlmMjA4N2RjMDBlZmNhNjJiNWQ5MGE2YTc3MWZhNzc4YjhjMDMxMDE5MjMwMzk2NTAzNWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.Yr-kEC2fzFNksGeZ7N8UYE18JuIwXtnVqhgZNWhqt1I
https://private-user-images.githubusercontent.com/65446343/273424242-77fa19fd-0905-4454-b5d7-b8b7298a7e3c.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTUxODI0NjQsIm5iZiI6MTc5NTE4MjE2NCwicGF0aCI6Ii82NTQ0NjM0My8yNzM0MjQyNDItNzdmYTE5ZmQtMDkwNS00NDU0LWI1ZDctYjhiNzI5OGE3ZTNjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTIwVDEzNDI0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTExYjU5NjJmOTU5MzkxNjVkZmQ2ZWRhMzM1YmE2ZDUzY2E4MzVjMTU2Mzc4ZTg5Njg0MThmOTU5ZTFhYmMyOGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.RldXlcC2ALEQ-ywDZFeb8nEg3Vsaed3-K8hLPZp6OSc
AlexWaygoodhttps://github.com/AlexWaygood
topic-testshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-tests%22
on Sep 6, 2024https://github.com/python/mypy/issues/15326#event-14165303784
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/15326
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/15326
featurehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22feature%22
topic-developerIssues relevant to mypy developershttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-developer%22
topic-testshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-tests%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.