def _is_same_fields_long(self, fields1, fields2): # pragma: no cover """helper for __eq__""" out = [] for (field1, field2) in zip(fields1, fields2): is_samei = is_same(field1, field2) out.append(is_samei) return out
def _is_same_fields(self, fields1: List[Union[int, float, str, None]], fields2: List[Union[int, float, str, None]]) -> bool: for (field1, field2) in zip(fields1, fields2): if not is_same(field1, field2): return False return True
def _is_same_card(self, prop, debug=False): if self.type != prop.type: return False fields2 = [prop.nsm, prop.sb, prop.ft, prop.TRef, prop.ge, prop.lam] fields1 = [self.nsm, self.sb, self.ft, self.TRef, self.ge, self.lam] for ply in self.plies: fields1 += ply for ply in prop.plies: fields2 += ply if debug: print("fields1=%s fields2=%s" % (fields1, fields2)) for (field1, field2) in zip(fields1, fields2): if not is_same(field1, field2): return False return True
def test_same(self): self.assertTrue(is_same(1.0, 1.000)) self.assertFalse(is_same(1.0, 1e-15 + 1)) self.assertTrue(is_same('MAT', 'MAT')) self.assertFalse(is_same('MAT', 'MAT1'))
def _is_same_fields(self, fields1, fields2): # type: (List[Optional[Union[int, float, str]]], List[Optional[Union[int, float, str]]]) -> bool for (field1, field2) in zip(fields1, fields2): if not is_same(field1, field2): return False return True
def _is_same_fields(self, fields1, fields2): for (field1, field2) in zip(fields1, fields2): if not is_same(field1, field2): return False return True