@@ -60,11 +60,13 @@ def test_serialize_plan_table_scan_request() -> None:
6060 filter = Expression (root = expression ),
6161 case_sensitive = True ,
6262 )
63+ # Assert that JSON matches.
6364 assert request .model_dump_json (exclude_none = True ) == snapshot_json_for_plan_table_scan_request ()
6465
6566
6667def test_deserialize_plan_table_scan_request () -> None :
67- """Test deserializing a PlanTableScanRequest from a dict"""
68+ """Test deserializing a dict to a PlanTableScanRequest"""
69+ model = PlanTableScanRequest .model_validate_json (snapshot_json_for_plan_table_scan_request ())
6870 expression = AndOrExpression (
6971 type = "and" ,
7072 left = Expression (
@@ -86,18 +88,22 @@ def test_deserialize_plan_table_scan_request() -> None:
8688 ),
8789 right = Expression (root = LiteralExpression (type = "gt" , term = Term (root = "d" ), value = {"type" : "integer" , "value" : 4 })),
8890 )
89- request = PlanTableScanRequest (
91+ expected = PlanTableScanRequest (
9092 snapshot_id = 1 ,
9193 select = ["a" , "b" , "c" ],
9294 filter = Expression (root = expression ),
9395 case_sensitive = True ,
9496 )
95- assert request == PlanTableScanRequest .model_validate_json (snapshot_json_for_plan_table_scan_request ())
97+
98+ # Assert that deserialized dict == Python object
99+ assert model == expected
96100
97101
98102def test_deserialize_scan_tasks () -> None :
99- """Test deserializing a ScanTasks from a dict """
103+ """Test deserializing dict to ScanTasks """
100104 scan_tasks = ScanTasks .model_validate_json (snapshot_json_for_scan_tasks ())
105+
106+ # Assert JSON fields match expected.
101107 assert len (scan_tasks .file_scan_tasks ) == 1
102108 assert len (scan_tasks .delete_files ) == 2
103109 assert scan_tasks .file_scan_tasks [0 ].data_file .file_path == "/path/to/data-a.parquet"
@@ -148,6 +154,8 @@ def test_serialize_scan_tasks() -> None:
148154 ),
149155 ],
150156 )
157+
158+ # Assert that JSON matches.
151159 assert scan_tasks .model_dump_json (exclude_none = True ) == snapshot_json_for_scan_tasks ()
152160
153161
0 commit comments