Skip to content

Commit

Permalink
fire previous Fixed codes
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoj0942 committed Sep 27, 2023
1 parent 1c00f16 commit ac1bdb0
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 61 deletions.
9 changes: 0 additions & 9 deletions src/sqlacodegen/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import sqlalchemy
from sqlalchemy import (
ARRAY,
CHAR,
Boolean,
CheckConstraint,
Column,
Expand Down Expand Up @@ -546,14 +545,6 @@ def render_column_type(self, coltype: object) -> str:
):
del kwargs["astext_type"]

if isinstance(coltype, CHAR):
# If the column type is CHAR and it has a non-None collation,
# include the collation argument in the kwargs dictionary
# and remove any corresponding argument from the args list.
if coltype.collation is not None:
kwargs["collation"] = repr(coltype.collation)
args.pop()

if args or kwargs:
return render_callable(coltype.__class__.__name__, *args, kwargs=kwargs)
else:
Expand Down
26 changes: 0 additions & 26 deletions tests/test_generator_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,32 +245,6 @@ def test_mysql_column_types(generator: CodeGenerator) -> None:
)


@pytest.mark.parametrize("engine", ["mysql"], indirect=["engine"])
def test_mysql_char_collation(generator: CodeGenerator) -> None:
Table(
"simple_items",
generator.metadata,
Column("id", mysql.INTEGER),
Column("name", mysql.CHAR(10, collation="utf8mb3_bin")),
)

validate_code(
generator.generate(),
"""\
from sqlalchemy import CHAR, Column, Integer, MetaData, Table
metadata = MetaData()
t_simple_items = Table(
'simple_items', metadata,
Column('id', Integer),
Column('name', CHAR(10, collation='utf8mb3_bin'))
)
""",
)


def test_constraints(generator: CodeGenerator) -> None:
Table(
"simple_items",
Expand Down
26 changes: 0 additions & 26 deletions tests/test_generator_tables2.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,32 +245,6 @@ def test_mysql_column_types(generator: CodeGenerator) -> None:
)


@pytest.mark.parametrize("engine", ["mysql"], indirect=["engine"])
def test_mysql_char_collation(generator: CodeGenerator) -> None:
Table(
"simple_items",
generator.metadata,
Column("id", mysql.INTEGER),
Column("name", mysql.CHAR(10, collation="utf8mb4_unicode_ci")),
)

validate_code(
generator.generate(),
"""\
from sqlalchemy import CHAR, Column, Integer, MetaData, Table
metadata = MetaData()
t_simple_items = Table(
'simple_items', metadata,
Column('id', Integer),
Column('name', CHAR(10, collation='utf8mb4_unicode_ci'))
)
""",
)


def test_constraints(generator: CodeGenerator) -> None:
Table(
"simple_items",
Expand Down

0 comments on commit ac1bdb0

Please sign in to comment.