Exemplo n.º 1
0
    def test_to_csv_single_result_no_stamp(self):
        test_data = {'time': [0]}
        result = Results(data=test_data)
        test_nametag = "test_nametag"

        with tempfile.TemporaryDirectory() as tempdir:
            result.to_csv(nametag=test_nametag, path=tempdir)
            assert len(os.listdir(tempdir)) is not 0
Exemplo n.º 2
0
    def test_to_csv_single_result_no_data(self):
        result = Results(data=None)
        test_nametag = "test_nametag"
        test_stamp = "test_stamp"

        with tempfile.TemporaryDirectory() as tempdir:
            result.to_csv(stamp=test_stamp, nametag=test_nametag, path=tempdir)
            test_path = tempdir + "/" + test_nametag + test_stamp
            assert not os.path.isdir(test_path)
Exemplo n.º 3
0
    def test_to_csv_single_result_no_path(self):
        test_data = {'time': [0]}
        result = Results(data=test_data)
        test_nametag = "test_nametag"
        test_stamp = "test_stamp"

        with tempfile.TemporaryDirectory() as tempdir:
            os.chdir(tempdir)
            result.to_csv(stamp=test_stamp, nametag=test_nametag)
            assert len(os.listdir(tempdir)) is not 0
Exemplo n.º 4
0
    def test_to_csv_single_result_no_nametag(self):
        test_data = {'time': [0]}
        test_model = Model('test_model')
        result = Results(data=test_data, model=test_model)
        result.solver_name = 'test_solver'
        test_stamp = "test_stamp"

        with tempfile.TemporaryDirectory() as tempdir:
            result.to_csv(stamp=test_stamp, path=tempdir)
            assert len(os.listdir(tempdir)) is not 0
Exemplo n.º 5
0
    def test_to_csv_single_result_file_exists(self):
        test_data = {'time': [0]}
        result = Results(data=test_data)
        test_nametag = "test_nametag"
        test_stamp = "test_stamp"

        with tempfile.TemporaryDirectory() as tempdir:
            result.to_csv(stamp=test_stamp, nametag=test_nametag, path=tempdir)
            test_path = tempdir + "/" + test_nametag + test_stamp + "/" + test_nametag + ".csv"
            assert os.path.isfile(test_path)