Back to index

python3.2  3.2.2
Public Member Functions
test.test_bigmem.TupleTest Class Reference

List of all members.

Public Member Functions

def test_compare
def basic_concat_test
def test_concat_small
def test_concat_large
def test_contains
def test_hash
def test_index_and_slice
def basic_test_repeat
def test_repeat_small
def test_repeat_large
def test_repeat_large_2
def test_from_2G_generator
def test_from_almost_2G_generator
def basic_test_repr
def test_repr_small
def test_repr_large

Detailed Description

Definition at line 731 of file test_bigmem.py.


Member Function Documentation

Definition at line 759 of file test_bigmem.py.

00759 
00760     def basic_concat_test(self, size):
00761         t = ((),) * size
00762         self.assertEqual(len(t), size)
00763         t = t + t
00764         self.assertEqual(len(t), size * 2)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 808 of file test_bigmem.py.

00808 
00809     def basic_test_repeat(self, size):
00810         t = ('',) * size
00811         self.assertEqual(len(t), size)
00812         t = t * 2
00813         self.assertEqual(len(t), size * 2)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_bigmem.TupleTest.basic_test_repr (   self,
  size 
)

Definition at line 854 of file test_bigmem.py.

00854 
00855     def basic_test_repr(self, size):
00856         t = (0,) * size
00857         s = repr(t)
00858         # The repr of a tuple of 0's is exactly three times the tuple length.
00859         self.assertEqual(len(s), size * 3)
00860         self.assertEqual(s[:5], '(0, 0')
00861         self.assertEqual(s[-5:], '0, 0)')
00862         self.assertEqual(s.count('0'), size)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_bigmem.TupleTest.test_compare (   self,
  size 
)

Definition at line 743 of file test_bigmem.py.

00743 
00744     def test_compare(self, size):
00745         t1 = ('',) * size
00746         t2 = ('',) * size
00747         self.assertEqual(t1, t2)
00748         del t2
00749         t2 = ('',) * (size + 1)
00750         self.assertFalse(t1 == t2)
00751         del t2
00752         t2 = (1,) * size
00753         self.assertFalse(t1 == t2)

Here is the call graph for this function:

Definition at line 770 of file test_bigmem.py.

00770 
00771     def test_concat_large(self, size):
00772         return self.basic_concat_test(size)

Here is the call graph for this function:

Definition at line 766 of file test_bigmem.py.

00766 
00767     def test_concat_small(self, size):
00768         return self.basic_concat_test(size)

Here is the call graph for this function:

def test.test_bigmem.TupleTest.test_contains (   self,
  size 
)

Definition at line 774 of file test_bigmem.py.

00774 
00775     def test_contains(self, size):
00776         t = (1, 2, 3, 4, 5) * size
00777         self.assertEqual(len(t), size * 5)
00778         self.assertIn(5, t)
00779         self.assertNotIn((1, 2, 3, 4, 5), t)
00780         self.assertNotIn(0, t)

Here is the call graph for this function:

Definition at line 827 of file test_bigmem.py.

00827 
00828     def test_from_2G_generator(self, size):
00829         self.skipTest("test needs much more memory than advertised, see issue5438")
00830         try:
00831             t = tuple(range(size))
00832         except MemoryError:
00833             pass # acceptable on 32-bit
00834         else:
00835             count = 0
00836             for item in t:
00837                 self.assertEqual(item, count)
00838                 count += 1
00839             self.assertEqual(count, size)

Here is the call graph for this function:

Definition at line 841 of file test_bigmem.py.

00841 
00842     def test_from_almost_2G_generator(self, size):
00843         self.skipTest("test needs much more memory than advertised, see issue5438")
00844         try:
00845             t = tuple(range(size))
00846             count = 0
00847             for item in t:
00848                 self.assertEqual(item, count)
00849                 count += 1
00850             self.assertEqual(count, size)
00851         except MemoryError:
00852             pass # acceptable, expected on 32-bit

Here is the call graph for this function:

def test.test_bigmem.TupleTest.test_hash (   self,
  size 
)

Definition at line 782 of file test_bigmem.py.

00782 
00783     def test_hash(self, size):
00784         t1 = (0,) * size
00785         h1 = hash(t1)
00786         del t1
00787         t2 = (0,) * (size + 1)
00788         self.assertFalse(h1 == hash(t2))

Here is the call graph for this function:

Definition at line 790 of file test_bigmem.py.

00790 
00791     def test_index_and_slice(self, size):
00792         t = (None,) * size
00793         self.assertEqual(len(t), size)
00794         self.assertEqual(t[-1], None)
00795         self.assertEqual(t[5], None)
00796         self.assertEqual(t[size - 1], None)
00797         self.assertRaises(IndexError, operator.getitem, t, size)
00798         self.assertEqual(t[:5], (None,) * 5)
00799         self.assertEqual(t[-5:], (None,) * 5)
00800         self.assertEqual(t[20:25], (None,) * 5)
00801         self.assertEqual(t[-25:-20], (None,) * 5)
00802         self.assertEqual(t[size - 5:], (None,) * 5)
00803         self.assertEqual(t[size - 5:size], (None,) * 5)
00804         self.assertEqual(t[size - 6:size - 2], (None,) * 4)
00805         self.assertEqual(t[size:size], ())
00806         self.assertEqual(t[size:size+5], ())

Here is the call graph for this function:

Definition at line 819 of file test_bigmem.py.

00819 
00820     def test_repeat_large(self, size):
00821         return self.basic_test_repeat(size)

Here is the call graph for this function:

Definition at line 823 of file test_bigmem.py.

00823 
00824     def test_repeat_large_2(self, size):
00825         return self.basic_test_repeat(size)

Here is the call graph for this function:

Definition at line 815 of file test_bigmem.py.

00815 
00816     def test_repeat_small(self, size):
00817         return self.basic_test_repeat(size)

Here is the call graph for this function:

def test.test_bigmem.TupleTest.test_repr_large (   self,
  size 
)

Definition at line 868 of file test_bigmem.py.

00868 
00869     def test_repr_large(self, size):
00870         return self.basic_test_repr(size)

Here is the call graph for this function:

def test.test_bigmem.TupleTest.test_repr_small (   self,
  size 
)

Definition at line 864 of file test_bigmem.py.

00864 
00865     def test_repr_small(self, size):
00866         return self.basic_test_repr(size)

Here is the call graph for this function:


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