From ac30a66ed493d03b5358fda3945aae0ca2b5b7c9 Mon Sep 17 00:00:00 2001 From: Frechdachs Date: Fri, 19 Feb 2016 08:30:53 +0100 Subject: Implement '==' and '!=' for ynbool 'ynbool(True) == "yes"', 'ynbool(True) == True' and 'ynbool(True) == ynbool(True)' were not working. --- mpv.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mpv.py') diff --git a/mpv.py b/mpv.py index fc03f7c..d3ed1a1 100644 --- a/mpv.py +++ b/mpv.py @@ -259,6 +259,9 @@ class ynbool: def __repr__(self): return str(self.val) + def __eq__(self, other): + return str(self) == other or bool(self) == other + def _ensure_encoding(possibly_bytes): return possibly_bytes.decode() if type(possibly_bytes) is bytes else possibly_bytes -- cgit