def test_translate_type_from_mysql_to_sqlite_invalid_column_type(
         self, mocker):
     with pytest.raises(ValueError) as excinfo:
         mocker.patch.object(MySQLtoSQLite,
                             "_valid_column_type",
                             return_value=False)
         MySQLtoSQLite._translate_type_from_mysql_to_sqlite("text")
     assert "Invalid column_type!" in str(excinfo.value)
 def test_translate_type_from_mysql_to_sqlite_all_valid_columns(self):
     for column_type in mysql_column_types + (
             "CHAR(2)",
             "NCHAR(7)",
             "NVARCHAR(17)",
             "VARCHAR(123)",
     ):
         if column_type in {"dialect", "insert", "Insert"}:
             continue
         elif column_type == "INT":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "INTEGER")
         elif column_type == "DECIMAL":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "DECIMAL")
         elif column_type == "YEAR":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "YEAR")
         elif column_type == "TIME":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "TIME")
         elif column_type == "TIMESTAMP":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "DATETIME")
         elif column_type in {
                 "BINARY",
                 "BIT",
                 "LONGBLOB",
                 "MEDIUMBLOB",
                 "TINYBLOB",
                 "VARBINARY",
         }:
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "BLOB")
         elif column_type == "CHAR":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "CHARACTER")
         elif column_type == "CHAR(2)":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "CHARACTER(2)")
         elif column_type == "NCHAR(7)":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "NCHAR(7)")
         elif column_type == "NVARCHAR(17)":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "NVARCHAR(17)")
         elif column_type == "VARCHAR(123)":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "VARCHAR(123)")
         elif column_type in {
                 "ENUM",
                 "JSON",
                 "LONGTEXT",
                 "MEDIUMTEXT",
                 "SET",
                 "TINYTEXT",
         }:
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "TEXT")
         else:
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == column_type)
 def test_translate_type_from_mysql_to_sqlite_all_valid_columns(self):
     for column_type in mysql_column_types + (
             "BIGINT UNSIGNED",
             "INTEGER UNSIGNED",
             "INT",
             "INT UNSIGNED",
             "SMALLINT UNSIGNED",
             "TINYINT UNSIGNED",
             "MEDIUMINT UNSIGNED",
             "CHAR(2)",
             "NCHAR(7)",
             "NVARCHAR(17)",
             "VARCHAR(123)",
     ):
         if column_type in {"dialect", "insert", "Insert"}:
             continue
         elif column_type == "INT":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "INTEGER")
         elif column_type == "DECIMAL":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "DECIMAL")
         elif column_type == "YEAR":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "YEAR")
         elif column_type == "TIME":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "TIME")
         elif column_type == "TIMESTAMP":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "DATETIME")
         elif column_type in {
                 "BINARY",
                 "BIT",
                 "LONGBLOB",
                 "MEDIUMBLOB",
                 "TINYBLOB",
                 "VARBINARY",
         }:
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "BLOB")
         elif column_type == "CHAR":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "CHARACTER")
         elif column_type == "CHAR(2)":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "CHARACTER(2)")
         elif column_type == "NCHAR(7)":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "NCHAR(7)")
         elif column_type == "NVARCHAR(17)":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "NVARCHAR(17)")
         elif column_type == "VARCHAR(123)":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "VARCHAR(123)")
         elif column_type in {
                 "ENUM",
                 "LONGTEXT",
                 "MEDIUMTEXT",
                 "SET",
                 "TINYTEXT",
         }:
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "TEXT")
         elif column_type == "JSON":
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == "TEXT")
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type,
                 sqlite_json1_extension_enabled=True) == "JSON")
         elif column_type.endswith(" UNSIGNED"):
             if column_type.startswith("INT "):
                 assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                     column_type) == "INTEGER")
             else:
                 assert MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                     column_type) == column_type.replace(" UNSIGNED", "")
         else:
             assert (MySQLtoSQLite._translate_type_from_mysql_to_sqlite(
                 column_type) == column_type)