def test_save_csv_exception(self): sample_str = "not a list" file_named = "test_1_error.csv" with pytest.raises(TypeError): result = save_csv(file_named, sample_str) assert result is None
def test_save_csv_slash_exception(self): csv_data = [] file_named = r"test\_1.csv" csv_data = [] count = 0 for _ in range(10): if count == 0: sample_dict = ["name", "date"] else: sample_dict = ["bob", str(datetime.datetime.now())] count += 1 csv_data.append(sample_dict) with pytest.raises(Exception): assert save_csv(file_named, csv_data)
def test_save_csv(self): csv_data = [] file_named = "test_1.csv" csv_data = [] count = 0 for _ in range(10): if count == 0: sample_dict = ["name", "date"] else: sample_dict = ["bob", str(datetime.datetime.now())] count += 1 csv_data.append(sample_dict) result = save_csv(file_named, csv_data) assert result == "complete"
def test_save_csv_exception(self): sample_str = "not a list" file_named = "test_1_error.csv" with pytest.raises(Exception): assert save_csv(file_named, sample_str)