Because Status.__eq__ didn't have the ability to compare str or unicode instances, using Pass() in ['pass'] would raise an exception. With this patch that is no longer the case, and that syntax works fine.
Signed-off-by: Dylan Baker <[email protected]> --- framework/status.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/status.py b/framework/status.py index d682531..2bca257 100644 --- a/framework/status.py +++ b/framework/status.py @@ -144,7 +144,13 @@ class Status(object): return int(self) <= int(other) def __eq__(self, other): - return int(self) == int(other) + # This must be int or status, since status comparisons are done using + # the __int__ magic method + if isinstance(other, (int, Status)): + return int(self) == int(other) + elif isinstance(other, (str, unicode)): + return unicode(self) == unicode(other) + raise TypeError("Cannot compare type: {}".format(type(other))) def __ne__(self, other): return int(self) != int(other) -- 1.9.0 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
