Back to index

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

List of all members.

Public Member Functions

def setUp
def test_sharedctypes
def test_synchronize
def test_copy
def assertTimingAlmostEqual
def assertReturnsIfImplemented
def __reduce__

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Public Attributes

tuple ALLOWED_TYPES = ('processes',)

Private Member Functions

def _double

Detailed Description

Definition at line 1726 of file test_multiprocessing.py.


Member Function Documentation

def test.test_multiprocessing.BaseTestCase.__reduce__ (   self,
  args 
) [inherited]

Definition at line 124 of file test_multiprocessing.py.

00124 
00125     def __reduce__(self, *args):
00126         raise NotImplementedError("shouldn't try to pickle a test case")

def test.test_multiprocessing._TestSharedCTypes._double (   cls,
  x,
  y,
  foo,
  arr,
  string 
) [private]

Definition at line 1735 of file test_multiprocessing.py.

01735 
01736     def _double(cls, x, y, foo, arr, string):
01737         x.value *= 2
01738         y.value *= 2
01739         foo.x *= 2
01740         foo.y *= 2
01741         string.value *= 2
01742         for i in range(len(arr)):
01743             arr[i] *= 2

Here is the caller graph for this function:

def test.test_multiprocessing.BaseTestCase.assertReturnsIfImplemented (   self,
  value,
  func,
  args 
) [inherited]

Definition at line 114 of file test_multiprocessing.py.

00114 
00115     def assertReturnsIfImplemented(self, value, func, *args):
00116         try:
00117             res = func(*args)
00118         except NotImplementedError:
00119             pass
00120         else:
00121             return self.assertEqual(value, res)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_multiprocessing.BaseTestCase.assertTimingAlmostEqual (   self,
  a,
  b 
) [inherited]

Definition at line 110 of file test_multiprocessing.py.

00110 
00111     def assertTimingAlmostEqual(self, a, b):
00112         if CHECK_TIMINGS:
00113             self.assertAlmostEqual(a, b, 1)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1730 of file test_multiprocessing.py.

01730 
01731     def setUp(self):
01732         if not HAS_SHAREDCTYPES:
01733             self.skipTest("requires multiprocessing.sharedctypes")

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1767 of file test_multiprocessing.py.

01767 
01768     def test_copy(self):
01769         foo = _Foo(2, 5.0)
01770         bar = copy(foo)
01771         foo.x = 0
01772         foo.y = 0
01773         self.assertEqual(bar.x, 2)
01774         self.assertAlmostEqual(bar.y, 5.0)
01775 
01776 #
01777 #
01778 #

Here is the call graph for this function:

Definition at line 1744 of file test_multiprocessing.py.

01744 
01745     def test_sharedctypes(self, lock=False):
01746         x = Value('i', 7, lock=lock)
01747         y = Value(c_double, 1.0/3.0, lock=lock)
01748         foo = Value(_Foo, 3, 2, lock=lock)
01749         arr = self.Array('d', list(range(10)), lock=lock)
01750         string = self.Array('c', 20, lock=lock)
01751         string.value = latin('hello')
01752 
01753         p = self.Process(target=self._double, args=(x, y, foo, arr, string))
01754         p.start()
01755         p.join()
01756 
01757         self.assertEqual(x.value, 14)
01758         self.assertAlmostEqual(y.value, 2.0/3.0)
01759         self.assertEqual(foo.x, 6)
01760         self.assertAlmostEqual(foo.y, 4.0)
01761         for i in range(10):
01762             self.assertAlmostEqual(arr[i], i*2)
01763         self.assertEqual(string.value, latin('hellohello'))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1764 of file test_multiprocessing.py.

01764 
01765     def test_synchronize(self):
01766         self.test_sharedctypes(lock=True)

Here is the call graph for this function:


Member Data Documentation

Reimplemented from test.test_multiprocessing.BaseTestCase.

Definition at line 1728 of file test_multiprocessing.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


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