1. Pypy
  2. Untitled project
  3. pypy

Commits

Amaury Forgeot d'Arc  committed b59013f

csv: fix tests when run with -A, then fix the implementation.

  • Participants
  • Parent commits 82b2f60
  • Branches py3k

Comments (0)

Files changed (2)

File pypy/module/_csv/interp_reader.py

View file
 
     def save_field(self, field_builder):
         field = field_builder.build()
+        print "AFA SAVE FIELD", field
         if self.numeric_field:
             from pypy.objspace.std.strutil import ParseStringError
             from pypy.objspace.std.strutil import string_to_float
                             state != START_RECORD and state != EAT_CRNL and
                             (len(field_builder.build()) > 0 or
                              state == IN_QUOTED_FIELD)):
-                        if dialect.strict:
-                            raise self.error(u"newline inside string")
-                        else:
-                            self.save_field(field_builder)
-                            break
+                        raise self.error(u"newline inside string")
                 raise
             self.line_num += 1
             line = space.unicode_w(w_line)

File pypy/module/_csv/test/test_reader.py

View file
     def test_cannot_read_bytes(self):
         import _csv
         reader = _csv.reader([b'foo'])
-        raises(TypeError, "next(reader)")
+        raises((TypeError, _csv.Error), next, reader)
 
     def test_read_oddinputs(self):
         self._read_test([], [])
         self._read_test(['12,12,1",'], [['12', '12', '1"', '']])
 
     def test_read_eof(self):
-        self._read_test(['a,"'], [['a', '']])
-        self._read_test(['"a'], [['a']])
-        self._read_test(['^'], [['\n']], escapechar='^')
-        self._read_test(['a,"'], 'Error', strict=True)
+        self._read_test(['a,"'], [])
+        self._read_test(['"a'], 'Error')
+        self._read_test(['^'], 'Error', escapechar='^')
+        self._read_test(['a,"'], [], strict=True)
         self._read_test(['"a'], 'Error', strict=True)
         self._read_test(['^'], 'Error', escapechar='^', strict=True)