jorisvandenbossche commented on code in PR #35735:
URL: https://github.com/apache/arrow/pull/35735#discussion_r1211619393
##########
python/pyarrow/tests/test_compute.py:
##########
@@ -1846,17 +1850,18 @@ def test_strptime():
assert got == pa.array([None, None, None], type=pa.timestamp('s'))
-# TODO: We should test on windows once ARROW-13168 is resolved.
@pytest.mark.pandas
[email protected](sys.platform == 'win32',
- reason="Timezone database is not available on Windows yet")
[email protected](sys.platform == "win32" and not util.windows_has_tzdata(),
+ reason="Timezone database is not installed on Windows")
def test_strftime():
times = ["2018-03-10 09:00", "2038-01-31 12:23", None]
timezones = ["CET", "UTC", "Europe/Ljubljana"]
- formats = ["%a", "%A", "%w", "%d", "%b", "%B", "%m", "%y", "%Y", "%H",
- "%I", "%p", "%M", "%z", "%Z", "%j", "%U", "%W", "%c", "%x",
- "%X", "%%", "%G", "%V", "%u"]
+ formats = ["%a", "%A", "%w", "%d", "%b", "%B", "%m", "%y", "%Y", "%H",
"%I",
+ "%p", "%M", "%z", "%Z", "%j", "%U", "%W", "%%", "%G", "%V",
"%u"]
+ if sys.platform != "win32":
+ # Locale-dependent formats don't match on Windows
+ formats.extend(["%c", "%x", "%X"])
Review Comment:
The error on Appveyor we got was:
```
@pytest.mark.skipif(sys.platform == "win32" and not
util.windows_has_tzdata(),
reason="Timezone database is not installed on
Windows")
def test_strftime():
times = ["2018-03-10 09:00", "2038-01-31 12:23", None]
timezones = ["CET", "UTC", "Europe/Ljubljana"]
formats = ["%a", "%A", "%w", "%d", "%b", "%B", "%m", "%y", "%Y",
"%H",
"%I", "%p", "%M", "%z", "%Z", "%j", "%U", "%W", "%c",
"%x",
"%X", "%%", "%G", "%V", "%u"]
for timezone in timezones:
ts = pd.to_datetime(times).tz_localize(timezone)
for unit in ["s", "ms", "us", "ns"]:
tsa = pa.array(ts, type=pa.timestamp(unit, timezone))
for fmt in formats:
options = pc.StrftimeOptions(fmt)
result = pc.strftime(tsa, options=options)
expected = pa.array(ts.strftime(fmt))
> assert result.equals(expected)
E assert False
E + where False = <built-in method equals of
pyarrow.lib.StringArray object at 0x0000023767338600>(<pyarrow.lib.StringArray
object at 0x0000023767338830>\n[\n "Sat Mar 10 09:00:00 2018",\n "Sun Jan 31
12:23:00 2038",\n null\n])
E + where <built-in method equals of
pyarrow.lib.StringArray object at 0x0000023767338600> =
<pyarrow.lib.StringArray object at 0x0000023767338600>\n[\n "03/10/18
09:00:00",\n "01/31/38 12:23:00",\n null\n].equals
pyarrow\tests\test_compute.py:1872: AssertionError
```
So it seems that we create a string like "Sat Mar 10 09:00:00 2018", but the
python version we compare with gives "03/10/18 09:00:00". According to docs for
`%c`, the former (our result) is actually correct.
But since we are checking matching results in Python in this test, just
skipping the ones where those don't match.
--
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]