2
#-----------------------------------------------------------------------------
3
# Copyright (c) 2010-2012 Brian Granger, Min Ragan-Kelley
5
# This file is part of pyzmq
7
# Distributed under the terms of the New BSD License. The full license is in
8
# the file COPYING.BSD, distributed as part of this software.
9
#-----------------------------------------------------------------------------
11
#-----------------------------------------------------------------------------
13
#-----------------------------------------------------------------------------
18
from unittest import TestCase
20
from zmq import Stopwatch, ZMQError
22
if sys.version_info[0] >= 3:
25
class TestStopWatch(TestCase):
27
def test_stop_long(self):
28
"""Ensure stop returns a long int."""
32
self.assertTrue(isinstance(us, long))
34
def test_stop_microseconds(self):
35
"""Test that stop/sleep have right units."""
42
self.assertAlmostEqual(us/1e6,(toc-tic),places=0)
44
def test_double_stop(self):
45
"""Test error raised on multiple calls to stop."""
49
self.assertRaises(ZMQError, watch.stop)
50
self.assertRaises(ZMQError, watch.stop)