Skip to content

TST: close sas read handles properly in tests #15100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pandas/io/tests/sas/test_sas7bdat.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_from_buffer(self):
iterator=True, encoding='utf-8')
df = rdr.read()
tm.assert_frame_equal(df, df0, check_exact=False)
rdr.close()

def test_from_iterator(self):
for j in 0, 1:
Expand All @@ -62,6 +63,7 @@ def test_from_iterator(self):
tm.assert_frame_equal(df, df0.iloc[0:2, :])
df = rdr.read(3)
tm.assert_frame_equal(df, df0.iloc[2:5, :])
rdr.close()

def test_iterator_loop(self):
# github #13654
Expand All @@ -74,6 +76,7 @@ def test_iterator_loop(self):
for x in rdr:
y += x.shape[0]
self.assertTrue(y == rdr.row_count)
rdr.close()

def test_iterator_read_too_much(self):
# github #14734
Expand All @@ -82,9 +85,12 @@ def test_iterator_read_too_much(self):
rdr = pd.read_sas(fname, format="sas7bdat",
iterator=True, encoding='utf-8')
d1 = rdr.read(rdr.row_count + 20)
rdr.close()

rdr = pd.read_sas(fname, iterator=True, encoding="utf-8")
d2 = rdr.read(rdr.row_count + 20)
tm.assert_frame_equal(d1, d2)
rdr.close()


def test_encoding_options():
Expand Down