Use assertAlmostEqual (#1054)

Rounding and then comparing could lead to some surprising sensitivity. This
uses a known-good approximate comparison.
This commit is contained in:
Adrian Sampson 2014-11-01 13:07:10 -07:00
parent 256a3b4055
commit 832d658571

View file

@ -74,8 +74,7 @@ class ImportAddedTest(unittest.TestCase, ImportHelper):
def assertEqualTimes(self, first, second, msg=None):
"""For comparing file modification times at a sufficient precision"""
assert round(first, 4) == round(second, 4), \
"{:f} != {:f}{}".format(first, second, ": " + msg if msg else "")
self.assertAlmostEqual(first, second, places=4, msg=msg)
def test_import_album_with_added_dates(self):
self.importer.run()