Back to index

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

List of all members.

Public Member Functions

def f
def test_array
def test_array_from_size
def test_rawarray
def test_getobj_getlock_obj
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',)

Detailed Description

Definition at line 893 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.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:

def test.test_multiprocessing._TestArray.f (   cls,
  seq 
)

Definition at line 898 of file test_multiprocessing.py.

00898 
00899     def f(cls, seq):
00900         for i in range(1, len(seq)):
00901             seq[i] += seq[i-1]

Here is the caller graph for this function:

def test.test_multiprocessing._TestArray.test_array (   self,
  raw = False 
)

Definition at line 903 of file test_multiprocessing.py.

00903 
00904     def test_array(self, raw=False):
00905         seq = [680, 626, 934, 821, 150, 233, 548, 982, 714, 831]
00906         if raw:
00907             arr = self.RawArray('i', seq)
00908         else:
00909             arr = self.Array('i', seq)
00910 
00911         self.assertEqual(len(arr), len(seq))
00912         self.assertEqual(arr[3], seq[3])
00913         self.assertEqual(list(arr[2:7]), list(seq[2:7]))
00914 
00915         arr[4:8] = seq[4:8] = array.array('i', [1, 2, 3, 4])
00916 
00917         self.assertEqual(list(arr[:]), seq)
00918 
00919         self.f(seq)
00920 
00921         p = self.Process(target=self.f, args=(arr,))
00922         p.start()
00923         p.join()
00924 
00925         self.assertEqual(list(arr[:]), seq)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 927 of file test_multiprocessing.py.

00927 
00928     def test_array_from_size(self):
00929         size = 10
00930         # Test for zeroing (see issue #11675).
00931         # The repetition below strengthens the test by increasing the chances
00932         # of previously allocated non-zero memory being used for the new array
00933         # on the 2nd and 3rd loops.
00934         for _ in range(3):
00935             arr = self.Array('i', size)
00936             self.assertEqual(len(arr), size)
00937             self.assertEqual(list(arr), [0] * size)
00938             arr[:] = range(10)
00939             self.assertEqual(list(arr), list(range(10)))
00940             del arr

Here is the call graph for this function:

Definition at line 946 of file test_multiprocessing.py.

00946 
00947     def test_getobj_getlock_obj(self):
00948         arr1 = self.Array('i', list(range(10)))
00949         lock1 = arr1.get_lock()
00950         obj1 = arr1.get_obj()
00951 
00952         arr2 = self.Array('i', list(range(10)), lock=None)
00953         lock2 = arr2.get_lock()
00954         obj2 = arr2.get_obj()
00955 
00956         lock = self.Lock()
00957         arr3 = self.Array('i', list(range(10)), lock=lock)
00958         lock3 = arr3.get_lock()
00959         obj3 = arr3.get_obj()
00960         self.assertEqual(lock, lock3)
00961 
00962         arr4 = self.Array('i', range(10), lock=False)
00963         self.assertFalse(hasattr(arr4, 'get_lock'))
00964         self.assertFalse(hasattr(arr4, 'get_obj'))
00965         self.assertRaises(AttributeError,
00966                           self.Array, 'i', range(10), lock='notalock')
00967 
00968         arr5 = self.RawArray('i', range(10))
00969         self.assertFalse(hasattr(arr5, 'get_lock'))
00970         self.assertFalse(hasattr(arr5, 'get_obj'))
00971 
00972 #
00973 #
00974 #

Here is the call graph for this function:

Definition at line 942 of file test_multiprocessing.py.

00942 
00943     def test_rawarray(self):
00944         self.test_array(raw=True)

Here is the call graph for this function:


Member Data Documentation

tuple test.test_multiprocessing._TestArray.ALLOWED_TYPES = ('processes',) [static]

Reimplemented from test.test_multiprocessing.BaseTestCase.

Definition at line 895 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: