We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ecaef69 commit 73510b6Copy full SHA for 73510b6
pandas/io/tests/parser/common.py
@@ -1605,6 +1605,23 @@ def test_internal_eof_byte(self):
1605
1606
def test_file_handles(self):
1607
# GH 14418 - don't close user provided file handles
1608
+
1609
fh = StringIO('a,b\n1,2')
1610
self.read_csv(fh)
1611
self.assertFalse(fh.closed)
1612
1613
+ with open(self.csv1, 'r') as f:
1614
+ self.read_csv(f)
1615
+ self.assertFalse(f.closed)
1616
1617
+ # mmap not working with python engine
1618
+ if self.engine != 'python':
1619
1620
+ import mmap
1621
1622
+ m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
1623
+ self.read_csv(m)
1624
+ # closed attribute new in python 3.2
1625
+ if PY3:
1626
+ self.assertFalse(m.closed)
1627
+ m.close()
0 commit comments