summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_imp.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-10-22 00:09:51 (GMT)
committerGuido van Rossum <guido@python.org>2007-10-22 00:09:51 (GMT)
commit40d20bcf1fccfe8af2393f1aec88ba18e38d0bc1 (patch)
tree0d6616333b9c3cb004b659751fe9baa4bac67ad2 /Lib/test/test_imp.py
parentc2954e5273520031d3debfac8c668b9e611303b3 (diff)
downloadcpython-40d20bcf1fccfe8af2393f1aec88ba18e38d0bc1.zip
cpython-40d20bcf1fccfe8af2393f1aec88ba18e38d0bc1.tar.gz
cpython-40d20bcf1fccfe8af2393f1aec88ba18e38d0bc1.tar.bz2
Issue 1267, continued.
Additional patch by Christian Heimes to deal more cleanly with the FILE* vs file-descriptor issues. I cleaned up his code a bit, and moved the lseek() call into import.c.
Diffstat (limited to 'Lib/test/test_imp.py')
-rw-r--r--Lib/test/test_imp.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 87efc33..268a4b7 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -44,6 +44,23 @@ class ImportTests(unittest.TestCase):
fd = imp.find_module("heapq")[0]
self.assertEqual(fd.encoding, "iso-8859-1")
+ def test_issue1267(self):
+ fp, filename, info = imp.find_module("pydoc")
+ self.assertNotEqual(fp, None)
+ self.assertEqual(fp.encoding, "iso-8859-1")
+ self.assertEqual(fp.tell(), 0)
+ self.assertEqual(fp.readline(), '#!/usr/bin/env python\n')
+ fp.close()
+
+ fp, filename, info = imp.find_module("tokenize")
+ self.assertNotEqual(fp, None)
+ self.assertEqual(fp.encoding, "utf-8")
+ self.assertEqual(fp.tell(), 0)
+ self.assertEqual(fp.readline(),
+ '"""Tokenization help for Python programs.\n')
+ fp.close()
+
+
def test_main():
test_support.run_unittest(
LockTests,