def setup_method(self, datapath): self.dirpath = datapath("io", "sas", "data") self.file01 = os.path.join(self.dirpath, "DEMO_G.xpt") self.file02 = os.path.join(self.dirpath, "SSHSV1_A.xpt") self.file03 = os.path.join(self.dirpath, "DRXFCD_G.xpt") self.file04 = os.path.join(self.dirpath, "paxraw_d_short.xpt") with td.file_leak_context(): yield
def test2_binary(self): # Test with SSHSV1_A.xpt, read as a binary file # Compare to this data_csv = pd.read_csv(self.file02.replace(".xpt", ".csv")) numeric_as_float(data_csv) with open(self.file02, "rb") as fd: with td.file_leak_context(): # GH#35693 ensure that if we pass an open file, we # dont incorrectly close it in read_sas data = read_sas(fd, format="xport") tm.assert_frame_equal(data, data_csv)
def setup_method(self): with td.file_leak_context(): yield