Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-111673: Refactor test_float/complex.py (split out support classes)#110956
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
Closed
Uh oh!
There was an error while loading. Please reload this page.
Closed
Changes from all commits
Commits
Show all changes
20 commits Select commit Hold shift + click to select a range
ddc670b Refactor test_float/complex.py
serhiy-storchaka 944de07 A continuation: factor out Complex/FloatLikeSubclass'es
skirpichev faf5d77 Merge branch 'main' into refactor-fc-tests
skirpichev 0dedc80 Move support classes to Lib/test/support/classes.py
skirpichev aa0fe89 Rename MyIndex -> IndexLike, MyInt -> IntLike
skirpichev aeeba48 Refactor Lib/test/test_capi/test_long.py
skirpichev 223c509 Redo Float/ComplexSubclass to return a different value from dunder me…
skirpichev bba21d1 Merge branch 'main' into refactor-fc-tests
skirpichev 88e1624 Merge branch 'master' into refactor-fc-tests
skirpichev 29c2862 Merge branch 'main' into refactor-fc-tests
skirpichev c2604af +1
skirpichev 09c8241 + convert Lib/test/test_capi/test_complex.py
skirpichev dae5b2c + convert Lib/test/test_capi/test_float.py
skirpichev 9830c25 Merge branch 'master' into refactor-fc-tests
skirpichev bfd4e36 + convert Lib/test/test_capi/test_getargs.py
skirpichev 139b646 Merge branch 'master' into refactor-fc-tests
skirpichev ca71582 Merge branch 'main' into refactor-fc-tests
skirpichev 17cb3ab Merge branch 'master' into refactor-fc-tests
skirpichev 0ee08e3 Merge branch 'master' into refactor-fc-tests
skirpichev ed6a546 address review: classes.py -> number_helper.py
skirpichev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Common test classes for numeric types. | ||
| class WithIndex: | ||
| def __init__(self, value): | ||
| self.value = value | ||
| def __index__(self): | ||
| return self.value | ||
| class IntSubclass(int): | ||
| pass | ||
| class WithInt: | ||
| def __init__(self, value): | ||
| self.value = value | ||
| def __int__(self): | ||
| return self.value | ||
| class WithIntAndIndex: | ||
| def __init__(self, value): | ||
| self.value = value | ||
| def __index__(self): | ||
| return self.value | ||
| def __int__(self): | ||
| return self.value + 12 | ||
| class FloatSubclass(float): | ||
| pass | ||
| class OtherFloatSubclass(float): | ||
| pass | ||
| class WithFloat: | ||
| def __init__(self, value): | ||
| self.value = value | ||
| def __float__(self): | ||
| return self.value | ||
| class FloatLikeSubclass(float): | ||
| def __init__(self, value): | ||
| self.value = value | ||
| def __float__(self): | ||
| return self.value.__class__(self.value*2) | ||
| class ComplexSubclass(complex): | ||
| pass | ||
| class OtherComplexSubclass(complex): | ||
| pass | ||
| class WithComplex: | ||
| def __init__(self, value): | ||
| self.value = value | ||
| def __complex__(self): | ||
| return self.value | ||
| class ComplexLikeSubclass(complex): | ||
| def __init__(self, value): | ||
| self.value = value | ||
| def __complex__(self): | ||
| return self.value.__class__(self.value*2) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 it's worth it to have OtherFloatSubclass and OtherComplexSubclass in this number_helper module.