moved scripts
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import csv
|
||||
from pathlib import Path
|
||||
|
||||
from tests.factories import B4wExportFactory
|
||||
|
||||
NUMBER_OF_ROWS = 50
|
||||
PATH_DEFAULT = Path("tests/test_data/b4w_export_dummy_01.csv")
|
||||
|
||||
|
||||
def save_csv(path: Path = PATH_DEFAULT):
|
||||
data = B4wExportFactory.batch(NUMBER_OF_ROWS)
|
||||
row_fields = list(data[0].parameters_to_dict())
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with path.open("w", newline="") as fid:
|
||||
writer = csv.DictWriter(fid, fieldnames=row_fields)
|
||||
writer.writeheader()
|
||||
for export in data:
|
||||
writer.writerow(export.parameters_to_dict())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
save_csv()
|
||||
Reference in New Issue
Block a user