Проверка на данном этапе

This commit is contained in:
vladslav064 committed 2026-11-12 08:02:52 +03:00
commit 626ac21b41
9 files changed
+1986

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import csv
from src.generate_data import generate_data
def test_record_count_and_header(tmp_path):
path = tmp_path / "orders.csv"
generate_data(path)
with path.open(encoding="utf-8", newline="") as source:
records = csv.reader(source)
assert next(records) == ["order_id", "order_date", "category", "quantity", "unit_price"]
assert sum(1 for _ in records) == 1500
def test_repeated_generation_is_byte_identical(tmp_path):
path = tmp_path / "orders.csv"
generate_data(path)
first_run = path.read_bytes()
generate_data(path)
assert path.read_bytes() == first_run