@property<EOL><INDENT>def tolerance(self):<DEDENT>
def set_default(x, default):<EOL><INDENT>return x if x is not None else default<EOL><DEDENT>absolute_tolerance = set_default(self.abs, self.DEFAULT_ABSOLUTE_TOLERANCE)<EOL>if absolute_tolerance < <NUM_LIT:0>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(absolute_tolerance)<EOL>)<EOL><DEDENT>if math.isnan(absolute_tolerance):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if self.rel is None:<EOL><INDENT>if self.abs is not None:<EOL><INDENT>return absolute_tolerance<EOL><DEDENT><DEDENT>relative_tolerance = set_default(<EOL>self.rel, self.DEFAULT_RELATIVE_TOLERANCE<EOL>) * abs(self.expected)<EOL>if relative_tolerance < <NUM_LIT:0>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(absolute_tolerance)<EOL>)<EOL><DEDENT>if math.isnan(relative_tolerance):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>return max(relative_tolerance, absolute_tolerance)<EOL>
Return the tolerance for the comparison.  This could be either an
absolute tolerance or a relative tolerance, depending on what the user
specified or which would be larger.