Back to index

python3.2  3.2.2
Public Member Functions
test.test_csv.TestLeaks Class Reference

List of all members.

Public Member Functions

def test_create_read
def test_create_write
def test_read
def test_write

Detailed Description

Definition at line 851 of file test_csv.py.


Member Function Documentation

Definition at line 852 of file test_csv.py.

00852 
00853         def test_create_read(self):
00854             delta = 0
00855             lastrc = sys.gettotalrefcount()
00856             for i in range(20):
00857                 gc.collect()
00858                 self.assertEqual(gc.garbage, [])
00859                 rc = sys.gettotalrefcount()
00860                 csv.reader(["a,b,c\r\n"])
00861                 csv.reader(["a,b,c\r\n"])
00862                 csv.reader(["a,b,c\r\n"])
00863                 delta = rc-lastrc
00864                 lastrc = rc
00865             # if csv.reader() leaks, last delta should be 3 or more
00866             self.assertEqual(delta < 3, True)

Here is the call graph for this function:

Definition at line 867 of file test_csv.py.

00867 
00868         def test_create_write(self):
00869             delta = 0
00870             lastrc = sys.gettotalrefcount()
00871             s = NUL()
00872             for i in range(20):
00873                 gc.collect()
00874                 self.assertEqual(gc.garbage, [])
00875                 rc = sys.gettotalrefcount()
00876                 csv.writer(s)
00877                 csv.writer(s)
00878                 csv.writer(s)
00879                 delta = rc-lastrc
00880                 lastrc = rc
00881             # if csv.writer() leaks, last delta should be 3 or more
00882             self.assertEqual(delta < 3, True)

Here is the call graph for this function:

Definition at line 883 of file test_csv.py.

00883 
00884         def test_read(self):
00885             delta = 0
00886             rows = ["a,b,c\r\n"]*5
00887             lastrc = sys.gettotalrefcount()
00888             for i in range(20):
00889                 gc.collect()
00890                 self.assertEqual(gc.garbage, [])
00891                 rc = sys.gettotalrefcount()
00892                 rdr = csv.reader(rows)
00893                 for row in rdr:
00894                     pass
00895                 delta = rc-lastrc
00896                 lastrc = rc
00897             # if reader leaks during read, delta should be 5 or more
00898             self.assertEqual(delta < 5, True)

Here is the call graph for this function:

Definition at line 899 of file test_csv.py.

00899 
00900         def test_write(self):
00901             delta = 0
00902             rows = [[1,2,3]]*5
00903             s = NUL()
00904             lastrc = sys.gettotalrefcount()
00905             for i in range(20):
00906                 gc.collect()
00907                 self.assertEqual(gc.garbage, [])
00908                 rc = sys.gettotalrefcount()
00909                 writer = csv.writer(s)
00910                 for row in rows:
00911                     writer.writerow(row)
00912                 delta = rc-lastrc
00913                 lastrc = rc
00914             # if writer leaks during write, last delta should be 5 or more
00915             self.assertEqual(delta < 5, True)

Here is the call graph for this function:

Here is the caller graph for this function:


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