Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_xport_write_dates(self):
#if sys.version_info[0] < 3:
# return
path = os.path.join(self.write_folder, "dates_write.xpt")
pyreadstat.write_xport(self.df_sas_dates, path)
df, meta = pyreadstat.read_xport(path)
self.assertTrue(df.equals(self.df_sas_dates))
def test_xport_write_basic(self):
file_label = "basic write"
table_name = "TEST"
col_labels = ["mychar label","mynum label", "mydate label", "dtime label", None, "myord label", "mytime label"]
path = os.path.join(self.write_folder, "write.xpt")
pyreadstat.write_xport(self.df_pandas, path, file_label=file_label, column_labels=col_labels, table_name=table_name)
df, meta = pyreadstat.read_xport(path)
df.columns = [x.lower() for x in df.columns]
self.assertTrue(df.equals(self.df_pandas))
self.assertEqual(meta.file_label, file_label)
self.assertListEqual(meta.column_labels, col_labels)
self.assertEqual(table_name, meta.table_name)