The post has been translated automatically. Original language: Russian
A morning delivery opens cleanly and the totals table is present. The detail import stops because the ZIP contains only totals.csv. Should the sender retry the same archive after a successful integrity check? Consider a teaching package containing no customer data.
Completed test record. The delivery agreement requires exactly one totals.csv and one lines.csv. A ZIP was created containing totals.csv alone. Python’s ZipFile.testzip() returned None: reading the existing member found no CRC or header error. namelist() returned just totals.csv. Comparing that result with the agreement reveals the missing lines.csv. Reject the package before import.
For a paired control, supply both files but leave only a header in lines.csv. The names check now passes. Whether an empty file is valid depends on the agreed rule for a period with no activity. If the summary reports sales, reconcile the detail count and amount with independent control totals. The archive cannot establish the completeness of its own export.
Put the delivery identifier, expected and actual contents, and the specific reason for rejection on the receipt. A retry makes sense once the package contents have been corrected. Recompressing the same inputs will not recreate missing rows.
Acceptance test: three packages, one decision to release
Control run with teaching data. All three archives declare a total of 90. The first lacks the detail file. The second has a header-only lines.csv: zero rows despite the positive total. The third has two rows worth 40 and 50. testzip() returned None in every case. Only the third package passes both the file list check and reconciliation to the independently specified two rows totaling 90. Two incorrect rows adding up to the same amount would require a comparison of row identifiers.
У получателя утренней поставки открывается ZIP с итогами. Загрузка строк детализации останавливается: внутри только totals.csv. Можно ли повторно отправить тот же архив после успешной проверки целостности? Разберём это на маленьком учебном пакете без данных клиентов.
Заполненный протокол. По условиям поставки обязательны totals.csv и lines.csv, по одному экземпляру. Для испытания создан ZIP только с totals.csv. Метод Python ZipFile.testzip() вернул None: при чтении существующего участника ошибок CRC и заголовка не обнаружено. Метод namelist() вернул единственное имя totals.csv. Итог сверки с условиями: отсутствует lines.csv. Пакет отклонён до импорта.
Парный контроль: собрать второй пакет с обоими именами, но оставить в lines.csv только заголовок. Проверка списка имён теперь пройдёт. Чтобы решить, допустим ли пустой файл, нужно отдельное правило для периода без операций. Если итог сообщает о продажах, сверить строки с контрольным количеством и суммой из независимого источника. Сам архив не докажет полноту собственной выгрузки.
В квитанции получателю полезны идентификатор поставки, ожидаемый и фактический состав и конкретная причина отказа. Тогда повторная отправка имеет смысл после исправления состава пакета. Повторное сжатие тех же файлов недостающие строки не создаст.
Контрольный прогон с учебными данными. Во всех трёх архивах итог равен 90. В первом нет файла детализации. Во втором в lines.csv есть только заголовок: ноль строк при положительном итоге. В третьем две строки с суммами 40 и 50. Во всех трёх случаях testzip() вернул None. Только третий пакет проходит и проверку комплекта, и сверку с заранее заданными двумя строками на сумму 90. Такой контроль обнаруживает пропуск в этом примере; две неверные строки с той же суммой потребовали бы сверки по идентификаторам.
Comments 0
Newest Popular