Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
test.test_threading.EventTests Class Reference
Inheritance diagram for test.test_threading.EventTests:
Inheritance graph
[legend]
Collaboration diagram for test.test_threading.EventTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_is_set
def test_notify
def test_timeout
def setUp
def tearDown
def assertTimeout

Static Public Attributes

tuple eventtype = staticmethod(threading.Event)

Detailed Description

Definition at line 732 of file test_threading.py.


Member Function Documentation

def test.lock_tests.BaseTestCase.assertTimeout (   self,
  actual,
  expected 
) [inherited]

Definition at line 65 of file lock_tests.py.

00065 
00066     def assertTimeout(self, actual, expected):
00067         # The waiting and/or time.time() can be imprecise, which
00068         # is why comparing to the expected value would sometimes fail
00069         # (especially under Windows).
00070         self.assertGreaterEqual(actual, expected * 0.6)
00071         # Test nothing insane happened
00072         self.assertLess(actual, expected * 10.0)
00073 

Here is the call graph for this function:

Here is the caller graph for this function:

def test.lock_tests.BaseTestCase.setUp (   self) [inherited]

Reimplemented in test.lock_tests.BarrierTests.

Definition at line 58 of file lock_tests.py.

00058 
00059     def setUp(self):
00060         self._threads = support.threading_setup()

Here is the caller graph for this function:

def test.lock_tests.BaseTestCase.tearDown (   self) [inherited]

Reimplemented in test.lock_tests.BarrierTests.

Definition at line 61 of file lock_tests.py.

00061 
00062     def tearDown(self):
00063         support.threading_cleanup(*self._threads)
00064         support.reap_children()

Here is the caller graph for this function:

def test.lock_tests.EventTests.test_is_set (   self) [inherited]

Definition at line 292 of file lock_tests.py.

00292 
00293     def test_is_set(self):
00294         evt = self.eventtype()
00295         self.assertFalse(evt.is_set())
00296         evt.set()
00297         self.assertTrue(evt.is_set())
00298         evt.set()
00299         self.assertTrue(evt.is_set())
00300         evt.clear()
00301         self.assertFalse(evt.is_set())
00302         evt.clear()
00303         self.assertFalse(evt.is_set())

Here is the call graph for this function:

def test.lock_tests.EventTests.test_notify (   self) [inherited]

Definition at line 321 of file lock_tests.py.

00321 
00322     def test_notify(self):
00323         evt = self.eventtype()
00324         self._check_notify(evt)
00325         # Another time, after an explicit clear()
00326         evt.set()
00327         evt.clear()
00328         self._check_notify(evt)

Here is the call graph for this function:

def test.lock_tests.EventTests.test_timeout (   self) [inherited]

Definition at line 329 of file lock_tests.py.

00329 
00330     def test_timeout(self):
00331         evt = self.eventtype()
00332         results1 = []
00333         results2 = []
00334         N = 5
00335         def f():
00336             results1.append(evt.wait(0.0))
00337             t1 = time.time()
00338             r = evt.wait(0.5)
00339             t2 = time.time()
00340             results2.append((r, t2 - t1))
00341         Bunch(f, N).wait_for_finished()
00342         self.assertEqual(results1, [False] * N)
00343         for r, dt in results2:
00344             self.assertFalse(r)
00345             self.assertTimeout(dt, 0.5)
00346         # The event is set
00347         results1 = []
00348         results2 = []
00349         evt.set()
00350         Bunch(f, N).wait_for_finished()
00351         self.assertEqual(results1, [True] * N)
00352         for r, dt in results2:
00353             self.assertTrue(r)
00354 

Here is the call graph for this function:


Member Data Documentation

Definition at line 733 of file test_threading.py.


The documentation for this class was generated from the following file: