Closed carandraug closed 5 years ago
Here's a suggested fix https://github.com/carandraug/microscope/commit/c637f237f8cf492d6b81c52c92762ec4cc755849
It also removes the conversion of setted value from enum instance to its value. If the Setting getter does not return an enum instance, the setter should not accept one.
Fixed and tests adjusted with a67bbd9 . Closing.
The new Setting class and device settings systems handles enum types. If a device setting is an enum, the settings system will have the client return the enum value instead of the enum instance. However, the setter for a setting does not do this.
Consider this device:
In this case,
_get_mode()
returns an instance of<enum 'Mode'>
and the paired_set_mode()
takes an instance of<enum 'Mode'>
too.The settings system recognizes that the returned value is an enum and returns the enum value instead.
However, when setting the value, no reverse conversion is done:
So far, this has only been used in the new Andor camera class and all the enums in there are
IntEnum
which are alsoint
s where this should not be an issue.