Skip to content

Commit d4738bb

Browse files
Add tests to make format
1 parent e287e38 commit d4738bb

File tree

9 files changed

+2332
-1996
lines changed

9 files changed

+2332
-1996
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ HELP_TEXT += "\n"
9393
HELP_TEXT += " format runs code formatting\n"
9494
.PHONY: format
9595
format:
96-
uv run ruff format src tools
96+
uv run ruff format src tools tests
9797

9898
HELP_TEXT += " coverage generates code coverage reports\n"
9999
.PHONY: coverage

tests/test_adapter.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""
1717
C7N Type Adapter Test Cases.
1818
"""
19+
1920
import datetime
2021

2122
import celpy.adapter
@@ -28,30 +29,32 @@ def test_json_to_cel():
2829
assert str(celpy.adapter.json_to_cel(False)) == str(celpy.celtypes.BoolType(False))
2930
assert celpy.adapter.json_to_cel(2.5) == celpy.celtypes.DoubleType(2.5)
3031
assert celpy.adapter.json_to_cel(42) == celpy.celtypes.IntType(42)
31-
assert celpy.adapter.json_to_cel("Hello, world!") == celpy.celtypes.StringType("Hello, world!")
32+
assert celpy.adapter.json_to_cel("Hello, world!") == celpy.celtypes.StringType(
33+
"Hello, world!"
34+
)
3235
assert celpy.adapter.json_to_cel(None) is None
3336
assert celpy.adapter.json_to_cel(["Hello", "world!"]) == celpy.celtypes.ListType(
3437
[
3538
celpy.celtypes.StringType("Hello"),
3639
celpy.celtypes.StringType("world!"),
3740
]
3841
)
39-
assert celpy.adapter.json_to_cel(tuple(["Hello", "world!"])) == celpy.celtypes.ListType(
42+
assert celpy.adapter.json_to_cel(
43+
tuple(["Hello", "world!"])
44+
) == celpy.celtypes.ListType(
4045
[
4146
celpy.celtypes.StringType("Hello"),
4247
celpy.celtypes.StringType("world!"),
4348
]
4449
)
4550
assert celpy.adapter.json_to_cel({"Hello": "world!"}) == celpy.celtypes.MapType(
4651
{
47-
celpy.celtypes.StringType("Hello"):
48-
celpy.celtypes.StringType("world!"),
52+
celpy.celtypes.StringType("Hello"): celpy.celtypes.StringType("world!"),
4953
}
5054
)
51-
assert (
52-
celpy.adapter.json_to_cel(datetime.datetime(2020, 9, 10, 11, 12, 13, tzinfo=datetime.timezone.utc))
53-
== celpy.celtypes.TimestampType("2020-09-10T11:12:13Z")
54-
)
55-
assert (
56-
celpy.adapter.json_to_cel(datetime.timedelta(days=42)) == celpy.celtypes.DurationType("42d")
57-
)
55+
assert celpy.adapter.json_to_cel(
56+
datetime.datetime(2020, 9, 10, 11, 12, 13, tzinfo=datetime.timezone.utc)
57+
) == celpy.celtypes.TimestampType("2020-09-10T11:12:13Z")
58+
assert celpy.adapter.json_to_cel(
59+
datetime.timedelta(days=42)
60+
) == celpy.celtypes.DurationType("42d")

0 commit comments

Comments
 (0)