diff options
author | Georg Brandl <georg@python.org> | 2006-02-19 13:56:17 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-02-19 13:56:17 (GMT) |
commit | 67e9fb9d7afbd9935322420a7cadd4cb6538dcdf (patch) | |
tree | 2d6905f185cfca51ba3d9462882935c35a01b4fb /Lib/test | |
parent | 602b9ba6b37c4ac4ed445f8c9e9dccd68d631899 (diff) | |
download | cpython-67e9fb9d7afbd9935322420a7cadd4cb6538dcdf.zip cpython-67e9fb9d7afbd9935322420a7cadd4cb6538dcdf.tar.gz cpython-67e9fb9d7afbd9935322420a7cadd4cb6538dcdf.tar.bz2 |
Patch #1215184: fileinput now has a fileno() function for getting the
current file number.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_fileinput.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py index 285573c..be4cb8e 100644 --- a/Lib/test/test_fileinput.py +++ b/Lib/test/test_fileinput.py @@ -167,3 +167,19 @@ try: verify(lines == ["A\n", "B"]) finally: remove_tempfiles(t1) + +if verbose: + print "16. fileno()" +try: + t1 = writeTmp(1, ["A\nB"]) + t2 = writeTmp(2, ["C\nD"]) + fi = FileInput(files=(t1, t2)) + verify(fi.fileno() == -1) + line = fi.next() + verify(fi.fileno() != -1) + fi.nextfile() + verify(fi.fileno() == -1) + line = list(fi) + verify(fi.fileno() == -1) +finally: + remove_tempfiles(t1, t2) |