def testGeneratingCo2(self): simul = ReeferSimulator() df = simul.generateCo2Records(cid="C01", nb_records=100, product_id="P02") self.assertIsNotNone(df) self.assertEqual(df.size, 1800) # nb of rows x nbr of columns
append = True elif arg == "--db": useDB = True return (cid, simulation_type, nb_records, product_id, fname, append, useDB) if __name__ == "__main__": (cid, simulation_type, nb_records, product_id, fname, append, useDB) = parseArguments() if useDB: print(cid, simulation_type, nb_records, product_id) else: print(cid, simulation_type, nb_records, product_id, fname, append) simulator = ReeferSimulator() if simulation_type == ReeferSimulator.SIMUL_POWEROFF: df = simulator.generatePowerOffRecords(cid, nb_records, product_id) elif simulation_type == ReeferSimulator.SIMUL_CO2: df = simulator.generateCo2Records(cid, nb_records, product_id) elif simulation_type == ReeferSimulator.SIMUL_O2: df = simulator.generateO2Records(cid, nb_records, product_id) elif simulation_type == ReeferSimulator.SIMUL_TEMPERATURE: df = simulator.generateTemperatureRecords(cid, nb_records, product_id) elif simulation_type == ReeferSimulator.NORMAL: df = simulator.generateNormalRecords(cid, nb_records, product_id) else: print("Not a valid simulation") exit if (not useDB): saveFile(df, fname, append) else: saveToDB(df)