def test_write_arg_valid(self):
self._write_error_test(csv.Error, None)
self._write_test((), '')
self._write_test([None], '""')
self._write_error_test(csv.Error, [None], quoting = csv.QUOTE_NONE)
# Check that exceptions are passed up the chain
class BadList:
def __len__(self):
return 10;
def __getitem__(self, i):
if i > 2:
raise IOError
self._write_error_test(IOError, BadList())
class BadItem:
def __str__(self):
raise IOError
self._write_error_test(IOError, [BadItem()])
评论列表
文章目录