diff options
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/stopwatch.py | 2 | ||||
-rw-r--r-- | morphlib/stopwatch_tests.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/morphlib/stopwatch.py b/morphlib/stopwatch.py index 826d5704..bcdc9291 100644 --- a/morphlib/stopwatch.py +++ b/morphlib/stopwatch.py @@ -23,7 +23,7 @@ class Stopwatch(object): self.ticks = {} def tick(self, reference_object, name): - if not self.ticks.has_key(reference_object): + if not reference_object in self.ticks: self.ticks[reference_object] = {} self.ticks[reference_object][name] = datetime.now() diff --git a/morphlib/stopwatch_tests.py b/morphlib/stopwatch_tests.py index 5a6b1e07..7441eac3 100644 --- a/morphlib/stopwatch_tests.py +++ b/morphlib/stopwatch_tests.py @@ -32,9 +32,9 @@ class StopwatchTests(unittest.TestCase): self.stopwatch.tick('tick', 'a') assert self.stopwatch.times('tick') assert self.stopwatch.time('tick', 'a') - assert self.stopwatch.times('tick').has_key('a') - assert (self.stopwatch.time('tick', 'a') == - self.stopwatch.times('tick')['a']) + assert 'a' in self.stopwatch.times('tick') + self.assertEqual(self.stopwatch.time('tick', 'a'), + self.stopwatch.times('tick')['a']) now = datetime.datetime.now() assert self.stopwatch.time('tick', 'a') < now @@ -55,4 +55,4 @@ class StopwatchTests(unittest.TestCase): watch_delta = self.stopwatch.start_stop_delta('start-stop') assert our_delta.total_seconds() > 0 - assert our_delta == watch_delta + self.assertEqual(our_delta, watch_delta) |