tadeja commented on code in PR #55811:
URL: https://github.com/apache/arrow/pull/55811#discussion_r4769213280
##########
python/pyarrow/tests/test_scalars.py:
##########
@@ -529,6 +529,34 @@ def test_duration_nanos_nopandas():
arr[0].as_py()
+def test_day_time_and_month_interval():
+ arr1 = pa.array(
+ [datetime.datetime(2020, 1, 1), None, datetime.datetime(1900, 12, 13)],
+ type=pa.timestamp('s')
+ )
+ arr2 = pa.array(
+ [datetime.datetime(2020, 5, 5, 1, 30), None, None],
+ type=pa.timestamp('s')
+ )
+
+ arr = pc.month_interval_between(arr1, arr2)
+ assert isinstance(arr[0].as_py(), pa.Month)
+ assert arr[0].as_py() == pa.Month([4])
+ assert arr[0].as_py().months == 4
+ assert arr[0].value == arr[0].as_py()
+ assert arr[1].as_py(maps_as_pydicts="strict") is None
+ assert arr[1].value is None
+
+ arr = pc.day_time_interval_between(arr1, arr2)
+ assert isinstance(arr[0].as_py(), pa.DayTime)
+ assert arr[0].as_py() == pa.DayTime([125, 5400000])
+ assert arr[0].as_py().days == 125
+ assert arr[0].as_py().milliseconds == 5400000
+ assert arr[0].value == arr[0].as_py()
+ assert arr[1].as_py(maps_as_pydicts="strict") is None
+ assert arr[1].value is None
+
Review Comment:
```suggestion
assert arr[1].value is None
assert repr(arr[1]) == "<pyarrow.DayTimeIntervalScalar: None>"
```
EDIT: Correction to my previous line deletion (`assert arr[1].value is
None`) by accident
--
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]