Skip to content

Copying FpBinarySwitchable objects may result in the wrong min_value or max_value. #11

@smlgit

Description

@smlgit

Copying FpBinarySwitchable instances via copy.copy() does not copy the min_value and max_value fields correctly. It will set these to the current value:

>>> fs = FpBinarySwitchable(fp_mode=False, float_value=0.0)
>>> fs.value = -5.0
>>> fs.value = 5.0
>>> fs.value = 1.0
>>> fs.value, fs.min_value, fs.max_value
(1.0, -5.0, 5.0)
>>> fs2 = copy.copy(fs)
>>> fs2.value, fs2.min_value, fs2.max_value
(1.0, 1.0, 1.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions