def testDietWithInfFlagging(self): tdf = TicDatFactory(**dietSchema()) dat = tdf.copy_tic_dat(dietData()) tdf.set_infinity_io_flag(999999999) file_one = os.path.join(_scratchDir, "dietInfFlag.xls") file_two = os.path.join(_scratchDir, "dietInfFlag.xlsx") tdf.xls.write_file(dat, file_one) tdf.xls.write_file(dat, file_two) dat_1 = tdf.xls.create_tic_dat(file_one) dat_2 = tdf.xls.create_tic_dat(file_two) self.assertTrue(tdf._same_data(dat, dat_1)) self.assertTrue(tdf._same_data(dat, dat_2)) tdf = tdf.clone() dat_1 = tdf.xls.create_tic_dat(file_one) self.assertTrue(tdf._same_data(dat, dat_1)) tdf = TicDatFactory(**dietSchema()) dat_1 = tdf.xls.create_tic_dat(file_one) dat_2 = tdf.xls.create_tic_dat(file_two) self.assertFalse(tdf._same_data(dat, dat_1)) self.assertFalse(tdf._same_data(dat, dat_2)) self.assertTrue( {_.categories["protein"]["maxNutrition"] for _ in [dat_1, dat_2]} == {999999999}) for _ in [dat_1, dat_2]: _.categories["protein"]["maxNutrition"] = float("inf") self.assertTrue(tdf._same_data(dat, dat_1)) self.assertTrue(tdf._same_data(dat, dat_2))
def testDietWithInfFlagging(self): tdf = TicDatFactory(**dietSchema()) dat = tdf.copy_tic_dat(dietData()) tdf.set_infinity_io_flag(999999999) path = os.path.join(_scratchDir, "dietInfFlag") tdf.csv.write_directory(dat, path) dat_1 = tdf.csv.create_tic_dat(path) self.assertTrue(tdf._same_data(dat, dat_1)) tdf = tdf.clone() dat_1 = tdf.csv.create_tic_dat(path) self.assertTrue(tdf._same_data(dat, dat_1)) tdf = TicDatFactory(**dietSchema()) dat_1 = tdf.csv.create_tic_dat(path) self.assertFalse(tdf._same_data(dat, dat_1))
def testDietWithInfFlagging(self): tdf = TicDatFactory(**dietSchema()) dat = tdf.copy_tic_dat(dietData()) tdf.set_infinity_io_flag(999999999) file_one = os.path.join(_scratchDir, "dietInfFlag.sql") file_two = os.path.join(_scratchDir, "dietInfFlag.db") tdf.sql.write_sql_file(dat, file_one) tdf.sql.write_db_data(dat, file_two) dat_1 = tdf.sql.create_tic_dat_from_sql(file_one) dat_2 = tdf.sql.create_tic_dat(file_two) self.assertTrue(tdf._same_data(dat, dat_1)) self.assertTrue(tdf._same_data(dat, dat_2)) tdf = tdf.clone() dat_1 = tdf.sql.create_tic_dat_from_sql(file_one) self.assertTrue(tdf._same_data(dat, dat_1)) tdf = TicDatFactory(**dietSchema()) dat_1 = tdf.sql.create_tic_dat_from_sql(file_one) self.assertFalse(tdf._same_data(dat, dat_1))
def testDietWithInfFlagging(self): tdf = TicDatFactory(**dietSchema()) dat = tdf.copy_tic_dat(dietData()) tdf.set_infinity_io_flag(999999999) file_one = os.path.join(_scratchDir, "dietInfFlag_1.json") file_two = os.path.join(_scratchDir, "dietInfFlag_2.json") tdf.json.write_file(dat, file_one, verbose=True) tdf.json.write_file(dat, file_two, verbose=False) dat_1 = tdf.json.create_tic_dat(file_one) dat_2 = tdf.json.create_tic_dat(file_two) self.assertTrue(tdf._same_data(dat, dat_1)) self.assertTrue(tdf._same_data(dat, dat_2)) tdf = tdf.clone() dat_1 = tdf.json.create_tic_dat(file_one) self.assertTrue(tdf._same_data(dat, dat_1)) tdf = TicDatFactory(**dietSchema()) dat_1 = tdf.json.create_tic_dat(file_one) self.assertFalse(tdf._same_data(dat, dat_1))