@@ -110,6 +110,33 @@ def __repr__(self):
110110 )
111111
112112
113+ class DifferentVariantLevel (Diff ): # pylint: disable=too-few-public-methods
114+ """
115+ Represents a case where the property value is correct but the variant
116+ level does not match. The variant levels among the GetManagedObjects
117+ result, the Properties.GetAll result and the PropertiesChangedSignal
118+ result should always be the same, because both are encoded using dicts,
119+ and the values of the dicts are always defined as variant types, since
120+ they must be heterogeneous.
121+ """
122+
123+ def __init__ (
124+ self , object_path , interface_name , key , old_value , new_value
125+ ): # pylint: disable=too-many-positional-arguments,too-many-arguments
126+ self .object_path = object_path
127+ self .interface_name = interface_name
128+ self .key = key
129+ self .old_value = old_value
130+ self .new_value = new_value
131+
132+ def __repr__ (self ):
133+ return (
134+ f"DifferentVariantLevel({ self .object_path !r} , "
135+ f"{ self .interface_name !r} , { self .key !r} , { self .old_value !r} , "
136+ f"{ self .new_value !r} )"
137+ )
138+
139+
113140class NotInvalidatedProperty (Diff ): # pylint: disable=too-few-public-methods
114141 """
115142 Represents a case where the property should have been invalidated but
@@ -692,6 +719,14 @@ def _check_props(object_path, ifn, old_props, new_props):
692719 ChangedProperty (object_path , ifn , key , old_value , new_value )
693720 )
694721
722+ if (
723+ old_value is not INVALIDATED
724+ and new_value .variant_level != old_value .variant_level
725+ ):
726+ diffs .append (
727+ DifferentVariantLevel (object_path , ifn , key , old_value , new_value )
728+ )
729+
695730 return diffs
696731
697732 def _check ():
0 commit comments