'Test passes if ``first`` and ``second`` are approximately equal.
This test passes if ``first`` and ``second`` are equal to
within ``tol``, an absolute error, or ``rel``, a relative error.
If either ``tol`` or ``rel`` are None or not given, they default to
test attributes of the same name (by default, 0).
The objects may be either numbers, or sequences of numbers. Sequences
are tested element-by-element.
>>> class MyTest(NumericTestCase):
...     def test_number(self):
...         x = 1.0/6
...         y = sum([x]*6)
...         self.assertApproxEqual(y, 1.0, tol=1e-15)
...     def test_sequence(self):
...         a = [1.001, 1.001e-10, 1.001e10]
...         b = [1.0, 1e-10, 1e10]
...         self.assertApproxEqual(a, b, rel=1e-3)
>>> import unittest
>>> from io import StringIO  # Suppress test runner output.
>>> suite = unittest.TestLoader().loadTestsFromTestCase(MyTest)
>>> unittest.TextTestRunner(stream=StringIO()).run(suite)
<unittest.runner.TextTestResult run=2 errors=0 failures=0>'

def assertApproxEqual(self, first, second, tol=None, rel=None, msg=None):

    if (tol is None):
        tol = self.tol
    if (rel is None):
        rel = self.rel
    if (isinstance(first, collections.Sequence) and isinstance(second, collections.Sequence)):
        check = self._check_approx_seq
    else:
        check = self._check_approx_num
    check(first, second, tol, rel, msg)
