[Python-checkins] python/nondist/sandbox/csv/test test_csv.py,1.11,1.12
montanaro@users.sourceforge.net
montanaro@users.sourceforge.net
Mon, 03 Feb 2003 09:28:59 -0800
Update of /cvsroot/python/python/nondist/sandbox/csv/test
In directory sc8-pr-cvs1:/tmp/cvs-serv896
Modified Files:
test_csv.py
Log Message:
that was a dumb waste of time. I should have known there was no code in
_csv.c that depended on specific delimiters and quotechars...
Index: test_csv.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/csv/test/test_csv.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** test_csv.py 3 Feb 2003 17:24:18 -0000 1.11
--- test_csv.py 3 Feb 2003 17:28:55 -0000 1.12
***************
*** 112,212 ****
self.writerAssertEqual([[1, 2, 'a\nbc', 3, 4]], '1,2,"a\nbc",3,4\r\n')
- class MyWeirdDialect(csv.excel):
- quotechar = ':'
- delimiter = '\t'
-
- class TestExcelTabsColons(TestCsvBase):
- dialect = MyWeirdDialect()
-
- def test_single(self):
- self.readerAssertEqual('abc', [['abc']])
-
- def test_simple(self):
- self.readerAssertEqual('1\t2\t3\t4\t5', [['1','2','3','4','5']])
-
- def test_blankline(self):
- self.readerAssertEqual('', [])
-
- def test_empty_fields(self):
- self.readerAssertEqual('\t', [['', '']])
-
- def test_singlequoted(self):
- self.readerAssertEqual('::', [['']])
-
- def test_singlequoted_left_empty(self):
- self.readerAssertEqual('::\t', [['','']])
-
- def test_singlequoted_right_empty(self):
- self.readerAssertEqual('\t::', [['','']])
-
- def test_single_quoted_quote(self):
- self.readerAssertEqual('::::', [[':']])
-
- def test_quoted_quotes(self):
- self.readerAssertEqual('::::::', [['::']])
-
- def test_inline_quote(self):
- self.readerAssertEqual('a::b', [['a::b']])
-
- def test_inline_quotes(self):
- self.readerAssertEqual('a:b:c', [['a:b:c']])
-
- def test_quotes_and_more(self):
- self.readerAssertEqual(':a:b', [['ab']])
-
- def test_lone_quote(self):
- self.readerAssertEqual('a:b', [['a:b']])
-
- def test_quote_and_quote(self):
- self.readerAssertEqual(':a: :b:', [['a :b:']])
-
- def test_space_and_quote(self):
- self.readerAssertEqual(' :a:', [[' :a:']])
-
- def test_quoted(self):
- self.readerAssertEqual('1\t2\t3\t:I think,\ttherefore I am:\t5\t6',
- [['1', '2', '3',
- 'I think,\ttherefore I am',
- '5', '6']])
-
- def test_quoted_quote(self):
- self.readerAssertEqual('1\t2\t3\t:"I see,"\tsaid the blind man:\t:as he picked up his hammer and saw:',
- [['1', '2', '3',
- '"I see,"\tsaid the blind man',
- 'as he picked up his hammer and saw']])
-
- def test_quoted_nl(self):
- input = '''\
- 1\t2\t3\t:"I see,"
- \tsaid the blind man:\t:as he picked up his
- hammer and saw:
- 9\t8\t7\t6'''
- self.readerAssertEqual(input,
- [['1', '2', '3',
- '"I see,"\n\tsaid the blind man',
- 'as he picked up his\nhammer and saw'],
- ['9','8','7','6']])
-
- def test_dubious_quote(self):
- self.readerAssertEqual('12\t12\t1:\t', [['12', '12', '1:', '']])
-
- def test_null(self):
- self.writerAssertEqual([], '')
-
- def test_single(self):
- self.writerAssertEqual([['abc']], 'abc\r\n')
-
- def test_simple(self):
- self.writerAssertEqual([[1, 2, 'abc', 3, 4]], '1\t2\tabc\t3\t4\r\n')
-
- def test_quotes(self):
- self.writerAssertEqual([[1, 2, 'a:bc:', 3, 4]], '1\t2\t:a::bc:::\t3\t4\r\n')
-
- def test_quote_fieldsep(self):
- self.writerAssertEqual([['abc\tdef']], ':abc\tdef:\r\n')
-
- def test_newlines(self):
- self.writerAssertEqual([[1, 2, 'a\nbc', 3, 4]], '1\t2\t:a\nbc:\t3\t4\r\n')
-
class TestDictFields(unittest.TestCase):
def test_simple_dict(self):
--- 112,115 ----