Beispiel #1
0
    def test_export_table(self):
        """assert table correctly exported"""
        vdrive_file = self.filename
        o_vdrive = VDriveHandler(filename=vdrive_file)

        # raise error if one previous step is missing
        self.assertRaises(ValueError, o_vdrive.export, filename='test_me.txt')

        o_vdrive.run()

        # raise error if filename is missing
        self.assertRaises(ValueError, o_vdrive.export)

        # good to go now
        output_file = os.path.join(self.export_folder, 'test_output.txt')
        o_vdrive.export(filename=output_file)

        # test loading the file and checking content
        data_saved = pd.read_csv(output_file)
        row0_created = data_saved.iloc[1].values[:9]
        row0_expected = [
            5, 30, 0.702029178, 1.727360629, 0.604477306, 0.795381176,
            0.681151972, 1.70530957, 0.636809108
        ]
        _created_expected = zip(row0_created, row0_expected)
        for _created, _expected in _created_expected:
            self.assertAlmostEqual(_created, _expected, delta=self.maxDiff)
def vdrive_handler_to_mtex():

    args = parser.parse_args()

    o_vdrive = VDriveHandler(filename=args.input)
    o_vdrive.run()
    o_vdrive.export(filename=args.intermediate_output)

    o_handler = VDriveToMtex(filename=args.intermediate_output)
    o_handler.run()
    o_handler.export(filename=args.output)