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
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)
def test_to_csv_single_result_no_nametag(self): test_model = Model('test_model') test_data = Trajectory(data={'time': [0]}, model=test_model) result = Results(data=[test_data]) 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
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 + "0.csv" assert os.path.isfile(test_path)