Back to index

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

List of all members.

Public Member Functions

def test_int_write
def test_double_write
def test_float_write
def test_char_write

Detailed Description

Definition at line 662 of file test_csv.py.


Member Function Documentation

Definition at line 697 of file test_csv.py.

00697 
00698     def test_char_write(self):
00699         import array, string
00700         a = array.array('u', string.ascii_letters)
00701 
00702         with TemporaryFile("w+", newline='') as fileobj:
00703             writer = csv.writer(fileobj, dialect="excel")
00704             writer.writerow(a)
00705             expected = ",".join(a)+"\r\n"
00706             fileobj.seek(0)
00707             self.assertEqual(fileobj.read(), expected)

Here is the call graph for this function:

Definition at line 675 of file test_csv.py.

00675 
00676     def test_double_write(self):
00677         import array
00678         contents = [(20-i)*0.1 for i in range(20)]
00679         a = array.array('d', contents)
00680         with TemporaryFile("w+", newline='') as fileobj:
00681             writer = csv.writer(fileobj, dialect="excel")
00682             writer.writerow(a)
00683             expected = ",".join([str(i) for i in a])+"\r\n"
00684             fileobj.seek(0)
00685             self.assertEqual(fileobj.read(), expected)

Here is the call graph for this function:

Definition at line 686 of file test_csv.py.

00686 
00687     def test_float_write(self):
00688         import array
00689         contents = [(20-i)*0.1 for i in range(20)]
00690         a = array.array('f', contents)
00691         with TemporaryFile("w+", newline='') as fileobj:
00692             writer = csv.writer(fileobj, dialect="excel")
00693             writer.writerow(a)
00694             expected = ",".join([str(i) for i in a])+"\r\n"
00695             fileobj.seek(0)
00696             self.assertEqual(fileobj.read(), expected)

Here is the call graph for this function:

Definition at line 663 of file test_csv.py.

00663 
00664     def test_int_write(self):
00665         import array
00666         contents = [(20-i) for i in range(20)]
00667         a = array.array('i', contents)
00668 
00669         with TemporaryFile("w+", newline='') as fileobj:
00670             writer = csv.writer(fileobj, dialect="excel")
00671             writer.writerow(a)
00672             expected = ",".join([str(i) for i in a])+"\r\n"
00673             fileobj.seek(0)
00674             self.assertEqual(fileobj.read(), expected)

Here is the call graph for this function:


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