
My validation caught everything. Except what mattered.
Built data validation for a product feed importer. CSV comes in, checks run, flags issues. Clean data goes to database. Spent a week on it. Checked for empty fields, invalid URLs, price format, date format, SKU format. Passed every test. First real import. 2000 products. Zero validation errors. Perfect. Client checks dashboard next morning. "Why do 400 products say $0.00?" Turns out zero is valid Prices were there. Format was valid. Just all zeros. My validation: def validate_price ( price ): if not price : raise ValidationError ( " Price required " ) try : float_price = float ( price ) except ValueError : raise ValidationError ( " Price must be number " ) if float_price < 0 : raise ValidationError ( " Price cannot be negative " ) return True Looks fine. Checks for empty, checks format, checks negative. What could go wrong? Everything apparently. Zero is technically valid. Not empty. Not negative. Passes all checks. But no product costs $0. Obviously wrong data. Went back through CSV.
Continue reading on Dev.to Python
Opens in a new tab


![[MM’s] Boot Notes — The Day Zero Blueprint — Operations from localhost to production without panic](/_next/image?url=https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1433%2F1*cD3LWDy_XXNTdZ_8GYh6AA.png&w=1200&q=75)

