Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed as not planned
Labels
testsTests in the Lib/test dirTests in the Lib/test dir
Description
It is better to not import from one test in other tests, I propose adding a utils module for common types / helpers.
Originally posted by @sobolevn in #111624 (comment)
For example:
cpython/Lib/test/test_complex.py
Lines 446 to 450 in 93206d1
| classfloat2: | |
| def__init__(self, value): | |
| self.value=value | |
| def__float__(self): | |
| returnself.value |
and
cpython/Lib/test/test_capi/test_getargs.py
Lines 102 to 104 in 93206d1
| classFloat: | |
| def__float__(self): | |
| return4.25 |
cpython/Lib/test/test_capi/test_getargs.py
Lines 113 to 123 in 93206d1
| classBadFloat: | |
| def__float__(self): | |
| return687 | |
| classBadFloat2: | |
| def__float__(self): | |
| returnFloatSubclass(4.25) | |
| classBadFloat3(float): | |
| def__float__(self): | |
| returnFloatSubclass(4.25) |
we could unify to:
classFloatLike: def__init__(self, value): self.value=valuedef__float__(self): returnself.valueSuch support classes now scattered e.g. in Lib/test_float.py and in Lib/test_capi/test_getargs.py.
Linked PRs
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dir