diff --git a/tests/unit/test_unit_errors.py b/tests/unit/test_unit_errors.py index c009757..177a82b 100644 --- a/tests/unit/test_unit_errors.py +++ b/tests/unit/test_unit_errors.py @@ -41,6 +41,22 @@ def test_null_error_handling(): else: print("❌ Null error check FAILED.") +def test_1364_schema_mismatch(): + print("\n--- Testing 1364 Schema Mismatch ---") + raw = "(MySQLdb.OperationalError) (1364, \"Field 'account' doesn't have a default value\")" + formatted = format_db_error(raw) + print(f"Raw: {raw}") + print(f"Formatted: {formatted}") + + if (formatted.category == "database_schema" + and formatted.code == 1364 + and "account" in formatted.message + and "NOT NULL" in formatted.message): + print("✅ 1364 schema mismatch handled correctly.") + else: + print("❌ 1364 schema mismatch check FAILED.") + if __name__ == "__main__": test_error_formatting() test_null_error_handling() + test_1364_schema_mismatch()