Skip to content

Commit

Permalink
MINOR: [Python] Avoid failing pyarrow compute test on leap day (apach…
Browse files Browse the repository at this point in the history
…e#40288)

### Rationale for this change

Avoid creation of invalid datetimes when it is Feb 29, avoiding to have to investigate every four years why a lot of tests are failing

Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
  • Loading branch information
jorisvandenbossche authored and thisisnic committed Mar 8, 2024
1 parent 2445d51 commit e9fad14
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions python/pyarrow/tests/test_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -3214,8 +3214,7 @@ def test_list_element():


def test_count_distinct():
seed = datetime.datetime.now()
samples = [seed.replace(year=y) for y in range(1992, 2092)]
samples = [datetime.datetime(year=y, month=1, day=1) for y in range(1992, 2092)]
arr = pa.array(samples, pa.timestamp("ns"))
assert pc.count_distinct(arr) == pa.scalar(len(samples), type=pa.int64())

Expand Down

0 comments on commit e9fad14

Please sign in to comment.