[pypy-commit] pypy default: 'line_num' test

arigo noreply at buildbot.pypy.org
Mon Sep 24 18:10:27 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r57502:814b36029e7a
Date: 2012-09-24 16:02 +0200
http://bitbucket.org/pypy/pypy/changeset/814b36029e7a/

Log:	'line_num' test

diff --git a/pypy/module/_csv/test/test_reader.py b/pypy/module/_csv/test/test_reader.py
--- a/pypy/module/_csv/test/test_reader.py
+++ b/pypy/module/_csv/test/test_reader.py
@@ -83,3 +83,16 @@
             raises(TypeError, csv.field_size_limit, 1, None)
         finally:
             csv.field_size_limit(limit)
+
+    def test_read_linenum(self):
+        import _csv as csv
+        r = csv.reader(['line,1', 'line,2', 'line,3'])
+        assert r.line_num == 0
+        r.next()
+        assert r.line_num == 1
+        r.next()
+        assert r.line_num == 2
+        r.next()
+        assert r.line_num == 3
+        raises(StopIteration, r.next)
+        assert r.line_num == 3


More information about the pypy-commit mailing list