Example #1
0
 def equals(self, a, b):
     if type(a) != type(b):
         return False
     if isinstance(a, dict):
         if list(a.keys()) != list(b.keys()):
             return False
         for k in a:
             if not self.equals(a[k], b[k]):
                 return False
     elif isinstance(a, (list, tuple)):
         if len(a) != len(b):
             return False
         for ia, ib in zip(a, b):
             if not self.equals(ia, ib):
                 return False
     elif isinstance(a, dnp.ndarray):
         return dnp.all(a == b)
     else:
         return a == b
     return True
 def equals(self, a, b):
     if type(a) != type(b):
         return False
     if isinstance(a, dict):
         if a.keys() != b.keys():
             return False
         for k in a:
             if not self.equals(a[k], b[k]):
                 return False
     elif isinstance(a, (list, tuple)):
         if len(a) != len(b):
             return False
         for ia, ib in zip(a, b):
             if not self.equals(ia, ib):
                 return False
     elif isinstance(a, dnp.ndarray):
         return dnp.all(a == b)
     else:
         return a == b
     return True