Skip to content

tests/cpydiff: Test for PEP487 __init_subclass__. #16786

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AJMansfield
Copy link
Contributor

@AJMansfield AJMansfield commented Feb 19, 2025

Summary

This change documents and verifies the current absence of __init_subclass__ functionality, in anticipation of a possible future PEP487 'metaclasses lite' patch.

The main core_class_initsubclass.py test verifies if the method is automatically called, while the other three verify other orthogonal properties it should have: if the method is an implicit classmethod; if micropython supplies the base case for the usual recursive function body the PEP encourages; and if kwargs inheritance parameters work correctly.

Testing

I've verified that these tests fail as expected, correctly detecting the feature's absence.

Trade-offs and Alternatives

Some of the tests include code that regularizes across other unrelated differences between CPython and Micropython; but the complexity of this isn't large and it should be easy to verify that they wouldn't ever cause the tests to spuriously pass or fail.

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.44%. Comparing base (df05cae) to head (bfc173a).
Report is 9 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #16786   +/-   ##
=======================================
  Coverage   98.44%   98.44%           
=======================================
  Files         171      171           
  Lines       22192    22208   +16     
=======================================
+ Hits        21847    21863   +16     
  Misses        345      345           

☔ 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.

@AJMansfield AJMansfield force-pushed the cpydiff-initsubclass-pr branch 2 times, most recently from 43df2ca to c9ce19c Compare February 19, 2025 17:51
@AJMansfield
Copy link
Contributor Author

AJMansfield commented Feb 21, 2025

related: #15511 #16787

@dpgeorge dpgeorge added the tests Relates to tests/ directory in source label Mar 13, 2025
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Relates to tests/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy