rdblue commented on code in PR #5462:
URL: https://github.com/apache/iceberg/pull/5462#discussion_r942779370


##########
python/tests/test_transforms.py:
##########
@@ -139,6 +143,104 @@ def test_string_with_surrogate_pair():
     assert bucket_transform(string_with_surrogate_pair) == mmh3.hash(as_bytes)
 
 
[email protected](
+    "date,date_transform,expected",
+    [
+        (47, YearTransform(), "2017"),
+        (575, MonthTransform(), "2017-12"),
+        (17501, DayTransform(), "2017-12-01"),
+    ],
+)
+def test_date_to_human_string(date, date_transform, expected):
+    assert date_transform.to_human_string(DateType(), None) == "null"
+    assert date_transform.to_human_string(DateType(), date) == expected
+
+
[email protected](
+    "timestamp,time_transform,expected",
+    [
+        (47, YearTransform(), "2017"),
+        (575, MonthTransform(), "2017-12"),
+        (17501, DayTransform(), "2017-12-01"),
+        (420042, HourTransform(), "2017-12-01-18"),

Review Comment:
   You also need test cases for negative values:
   
   ```python
   (-1, YearTransform(), "1969"),
   (-1, MonthTransform(), "1969-12"),
   (-1, DayTransform(), "1969-12-31"),
   (-1, HourTransform(), "1969-12-31-23")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to