summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2011-12-06 17:18:05 +0100
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2011-12-06 17:18:05 +0100
commit36bed12a493017432e20d1ce7888f1f82a39cd6b (patch)
tree2d67967f88d563b984c446cbb359c510923e468b
parent7fc337aa46f8732ed4e6dcef8e40d3e350ea705b (diff)
downloadmorph-36bed12a493017432e20d1ce7888f1f82a39cd6b.tar.gz
Use assertEqual and drop has_keys().
-rw-r--r--morphlib/stopwatch.py2
-rw-r--r--morphlib/stopwatch_tests.py8
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)