URI: 
       tutil/Fiat: Fiat(No Data) should equal Fiat(No Data) - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 1f83711c268cf4d3b9d441a6bf4ab20172878c57
   DIR parent 46a236f167efbd973b0b53aa7550500e672996d2
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Fri, 19 Apr 2019 20:02:44 +0200
       
       util/Fiat: Fiat(No Data) should equal Fiat(No Data)
       
       Decimal('NaN') != Decimal('NaN')
       
       matters in e.g. qt history tab refresh (shortcut)
       
       Diffstat:
         M electrum/util.py                    |      11 +++++++++--
       
       1 file changed, 9 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/electrum/util.py b/electrum/util.py
       t@@ -161,9 +161,11 @@ class Satoshis(object):
        class Fiat(object):
            __slots__ = ('value', 'ccy')
        
       -    def __new__(cls, value, ccy):
       +    def __new__(cls, value: Optional[Decimal], ccy: str):
                self = super(Fiat, cls).__new__(cls)
                self.ccy = ccy
       +        if not isinstance(value, (Decimal, type(None))):
       +            raise TypeError(f"value should be Decimal or None, not {type(value)}")
                self.value = value
                return self
        
       t@@ -177,7 +179,12 @@ class Fiat(object):
                    return "{:.2f}".format(self.value)
        
            def __eq__(self, other):
       -        return self.ccy == other.ccy and self.value == other.value
       +        if self.ccy != other.ccy:
       +            return False
       +        if isinstance(self.value, Decimal) and isinstance(other.value, Decimal) \
       +                and self.value.is_nan() and other.value.is_nan():
       +            return True
       +        return self.value == other.value
        
            def __ne__(self, other):
                return not (self == other)