Skip to content

Refactor tests to split out common test types#111673

@skirpichev

Description

@skirpichev

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:

classfloat2:
def__init__(self, value):
self.value=value
def__float__(self):
returnself.value

and
classFloat:
def__float__(self):
return4.25

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

Such support classes now scattered e.g. in Lib/test_float.py and in Lib/test_capi/test_getargs.py.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions