Skip to content

Commit fbecd10

Browse files
ci: Add tests for serialization and printing of dy.Enum columns (#147)
Co-authored-by: Andreas Albert <[email protected]>
1 parent 2d5332f commit fbecd10

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/schema/test_repr.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,14 @@ def test_repr_with_rules() -> None:
5252
- "my_rule": [(col("a")) < (dyn int: 100)]
5353
- "my_group_rule": [(col("a").sum()) > (dyn int: 50)] grouped by ['a']
5454
""")
55+
56+
57+
def test_repr_enum() -> None:
58+
class SchemaNoRules(dy.Schema):
59+
a = dy.Enum(["a"])
60+
61+
assert repr(SchemaNoRules) == textwrap.dedent("""\
62+
[Schema "SchemaNoRules"]
63+
Columns:
64+
- "a": Enum(categories=['a'], nullable=True)
65+
""")

tests/schema/test_serialization.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def test_simple_serialization() -> None:
4040
create_schema("test", {"a": dy.Int64(check=[lambda expr: expr > 5])}),
4141
create_schema("test", {"a": dy.Int64(check={"x": lambda expr: expr > 5})}),
4242
create_schema("test", {"a": dy.Int64(alias="foo")}),
43+
create_schema("test", {"a": dy.Enum(["a"])}),
4344
create_schema("test", {"a": dy.Decimal(scale=2, min=Decimal("1.5"))}),
4445
create_schema("test", {"a": dy.Date(min=dt.date(2020, 1, 1))}),
4546
create_schema("test", {"a": dy.Datetime(min=dt.datetime(2020, 1, 1))}),

0 commit comments

Comments
 (0)