Ejemplo n.º 1
0
 def test_ncalls(self):
     t = Timer('test_ncalls')
     for i in range(10):
         t.start()
         t.stop()
     assert t.ncalls == 10
Ejemplo n.º 2
0
 def test_stop_nonstarted_fails(self):
     t = Timer('test_stop_nonstarted_fails')
     with pytest.raises(AssertionError):
         t.stop()
Ejemplo n.º 3
0
 def test_elapsed_nonstarted_fails(self):
     t = Timer('test_elapsed_nonstarted_fails')
     with pytest.raises(AssertionError):
         t.elapsed()
Ejemplo n.º 4
0
 def test_ncalls(self):
     t = Timer("test_ncalls")
     for i in range(10):
         t.start()
         t.stop()
     assert t.ncalls == 10
Ejemplo n.º 5
0
 def test_stop_nonstarted_fails(self):
     t = Timer("test_stop_nonstarted_fails")
     with pytest.raises(AssertionError):
         t.stop()
Ejemplo n.º 6
0
 def test_elapsed_nonstarted_fails(self):
     t = Timer("test_elapsed_nonstarted_fails")
     with pytest.raises(AssertionError):
         t.elapsed()