Back to index

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

List of all members.

Public Member Functions

def test_single
def test_simple
def test_blankline
def test_empty_fields
def test_singlequoted
def test_singlequoted_left_empty
def test_singlequoted_right_empty
def test_single_quoted_quote
def test_quoted_quotes
def test_inline_quote
def test_inline_quotes
def test_quotes_and_more
def test_lone_quote
def test_quote_and_quote
def test_space_and_quote
def test_quoted
def test_quoted_quote
def test_quoted_nl
def test_dubious_quote
def test_null
def test_single_writer
def test_simple_writer
def test_quotes
def test_quote_fieldsep
def test_newlines
def readerAssertEqual
def writerAssertEqual

Static Public Attributes

string dialect = 'excel'

Detailed Description

Definition at line 403 of file test_csv.py.


Member Function Documentation

def test.test_csv.TestCsvBase.readerAssertEqual (   self,
  input,
  expected_result 
) [inherited]

Definition at line 388 of file test_csv.py.

00388 
00389     def readerAssertEqual(self, input, expected_result):
00390         with TemporaryFile("w+", newline='') as fileobj:
00391             fileobj.write(input)
00392             fileobj.seek(0)
00393             reader = csv.reader(fileobj, dialect = self.dialect)
00394             fields = list(reader)
00395             self.assertEqual(fields, expected_result)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 412 of file test_csv.py.

00412 
00413     def test_blankline(self):
00414         self.readerAssertEqual('', [])

Here is the call graph for this function:

Definition at line 479 of file test_csv.py.

00479 
00480     def test_dubious_quote(self):
00481         self.readerAssertEqual('12,12,1",', [['12', '12', '1"', '']])

Here is the call graph for this function:

Definition at line 415 of file test_csv.py.

00415 
00416     def test_empty_fields(self):
00417         self.readerAssertEqual(',', [['', '']])

Here is the call graph for this function:

Definition at line 433 of file test_csv.py.

00433 
00434     def test_inline_quote(self):
00435         self.readerAssertEqual('a""b', [['a""b']])

Here is the call graph for this function:

Definition at line 436 of file test_csv.py.

00436 
00437     def test_inline_quotes(self):
00438         self.readerAssertEqual('a"b"c', [['a"b"c']])

Here is the call graph for this function:

Definition at line 444 of file test_csv.py.

00444 
00445     def test_lone_quote(self):
00446         self.readerAssertEqual('a"b', [['a"b']])

Here is the call graph for this function:

Definition at line 497 of file test_csv.py.

00497 
00498     def test_newlines(self):
00499         self.writerAssertEqual([[1, 2, 'a\nbc', 3, 4]], '1,2,"a\nbc",3,4\r\n')

Here is the call graph for this function:

Definition at line 482 of file test_csv.py.

00482 
00483     def test_null(self):
00484         self.writerAssertEqual([], '')

Here is the call graph for this function:

Definition at line 447 of file test_csv.py.

00447 
00448     def test_quote_and_quote(self):
00449         # Excel would never write a field containing '"a" "b"', but when
00450         # reading one, it will return 'a "b"'.
00451         self.readerAssertEqual('"a" "b"', [['a "b"']])

Here is the call graph for this function:

Definition at line 494 of file test_csv.py.

00494 
00495     def test_quote_fieldsep(self):
00496         self.writerAssertEqual([['abc,def']], '"abc,def"\r\n')

Here is the call graph for this function:

Definition at line 455 of file test_csv.py.

00455 
00456     def test_quoted(self):
00457         self.readerAssertEqual('1,2,3,"I think, therefore I am",5,6',
00458                                [['1', '2', '3',
00459                                  'I think, therefore I am',
00460                                  '5', '6']])

Here is the call graph for this function:

Definition at line 467 of file test_csv.py.

00467 
00468     def test_quoted_nl(self):
00469         input = '''\
00470 1,2,3,"""I see,""
00471 said the blind man","as he picked up his
00472 hammer and saw"
00473 9,8,7,6'''
00474         self.readerAssertEqual(input,
00475                                [['1', '2', '3',
00476                                    '"I see,"\nsaid the blind man',
00477                                    'as he picked up his\nhammer and saw'],
00478                                 ['9','8','7','6']])

Here is the call graph for this function:

Definition at line 461 of file test_csv.py.

00461 
00462     def test_quoted_quote(self):
00463         self.readerAssertEqual('1,2,3,"""I see,"" said the blind man","as he picked up his hammer and saw"',
00464                                [['1', '2', '3',
00465                                  '"I see," said the blind man',
00466                                  'as he picked up his hammer and saw']])

Here is the call graph for this function:

Definition at line 430 of file test_csv.py.

00430 
00431     def test_quoted_quotes(self):
00432         self.readerAssertEqual('""""""', [['""']])

Here is the call graph for this function:

Definition at line 491 of file test_csv.py.

00491 
00492     def test_quotes(self):
00493         self.writerAssertEqual([[1, 2, 'a"bc"', 3, 4]], '1,2,"a""bc""",3,4\r\n')

Here is the call graph for this function:

Definition at line 439 of file test_csv.py.

00439 
00440     def test_quotes_and_more(self):
00441         # Excel would never write a field containing '"a"b', but when
00442         # reading one, it will return 'ab'.
00443         self.readerAssertEqual('"a"b', [['ab']])

Here is the call graph for this function:

Definition at line 409 of file test_csv.py.

00409 
00410     def test_simple(self):
00411         self.readerAssertEqual('1,2,3,4,5', [['1','2','3','4','5']])

Here is the call graph for this function:

Definition at line 488 of file test_csv.py.

00488 
00489     def test_simple_writer(self):
00490         self.writerAssertEqual([[1, 2, 'abc', 3, 4]], '1,2,abc,3,4\r\n')

Here is the call graph for this function:

Definition at line 406 of file test_csv.py.

00406 
00407     def test_single(self):
00408         self.readerAssertEqual('abc', [['abc']])

Here is the call graph for this function:

Definition at line 427 of file test_csv.py.

00427 
00428     def test_single_quoted_quote(self):
00429         self.readerAssertEqual('""""', [['"']])

Here is the call graph for this function:

Definition at line 485 of file test_csv.py.

00485 
00486     def test_single_writer(self):
00487         self.writerAssertEqual([['abc']], 'abc\r\n')

Here is the call graph for this function:

Definition at line 418 of file test_csv.py.

00418 
00419     def test_singlequoted(self):
00420         self.readerAssertEqual('""', [['']])

Here is the call graph for this function:

Definition at line 421 of file test_csv.py.

00421 
00422     def test_singlequoted_left_empty(self):
00423         self.readerAssertEqual('"",', [['','']])

Here is the call graph for this function:

Definition at line 424 of file test_csv.py.

00424 
00425     def test_singlequoted_right_empty(self):
00426         self.readerAssertEqual(',""', [['','']])

Here is the call graph for this function:

Definition at line 452 of file test_csv.py.

00452 
00453     def test_space_and_quote(self):
00454         self.readerAssertEqual(' "a"', [[' "a"']])

Here is the call graph for this function:

def test.test_csv.TestCsvBase.writerAssertEqual (   self,
  input,
  expected_result 
) [inherited]

Definition at line 396 of file test_csv.py.

00396 
00397     def writerAssertEqual(self, input, expected_result):
00398         with TemporaryFile("w+", newline='') as fileobj:
00399             writer = csv.writer(fileobj, dialect = self.dialect)
00400             writer.writerows(input)
00401             fileobj.seek(0)
00402             self.assertEqual(fileobj.read(), expected_result)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 404 of file test_csv.py.


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