summaryrefslogtreecommitdiff
path: root/morphlib/stopwatch_tests.py
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2011-12-08 16:21:03 +0100
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2011-12-08 16:21:03 +0100
commitfedaaf7f6c6e616edd51ebed6eb049e6babe9d94 (patch)
treee4ee7e98fe6a98c6625b07e67591a5ba038336b4 /morphlib/stopwatch_tests.py
parent3248be791634da0052e56208881c66210e590403 (diff)
downloadmorph-fedaaf7f6c6e616edd51ebed6eb049e6babe9d94.tar.gz
Add Stopwatch.start_stop_seconds(), don't use timedelta.total_seconds().
This function is only available in Python >= 2.7. On http://docs.python.org/library/datetime.html#timedelta-objects it says total_seconds() is equal to (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 with true division enabled. We are using td.days * 24 * 3600 + td.seconds + operator.truediv(td.microseconds, 10**6) now in Stopwatch.start_stop_seconds(), which I find more readable.
Diffstat (limited to 'morphlib/stopwatch_tests.py')
-rw-r--r--morphlib/stopwatch_tests.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/morphlib/stopwatch_tests.py b/morphlib/stopwatch_tests.py
index 7441eac3..1a899f41 100644
--- a/morphlib/stopwatch_tests.py
+++ b/morphlib/stopwatch_tests.py
@@ -53,6 +53,6 @@ class StopwatchTests(unittest.TestCase):
our_delta = stop - start
watch_delta = self.stopwatch.start_stop_delta('start-stop')
-
- assert our_delta.total_seconds() > 0
self.assertEqual(our_delta, watch_delta)
+
+ assert self.stopwatch.start_stop_seconds('start-stop') > 0