Skip to content

Commit

Permalink
add test case for #65
Browse files Browse the repository at this point in the history
  • Loading branch information
Dracax committed Jan 17, 2025
1 parent fcac01d commit b74839e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/functional/generator/test_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,30 @@ class Material:
"""
result = create_models(ddl, models_type="dataclass")["code"]
assert expected == result


def test_default_boolean():
expected = """from dataclasses import dataclass
@dataclass
class Material:
id: int
name: str
edited: bool = False
deleted: bool = True
"""

ddl = """
CREATE TABLE Material
(
id integer,
name string,
edited boolean DEFAULT false,
deleted boolean DEFAULT true,
PRIMARY KEY (id, name)
);
"""
result = create_models(ddl, models_type="dataclass")["code"]
assert expected == result

0 comments on commit b74839e

Please sign in to comment.