MCPcopy Create free account
hub / github.com/apache/arrow / test_arange

Function test_arange

python/pyarrow/tests/test_array.py:657–680  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

655
656
657def test_arange():
658 cases = [
659 (5, 103), # Default step
660 (-2, 128, 3),
661 (4, 103, 5),
662 (10, -7, -1),
663 (100, -20, -3),
664 (0, 0), # Empty array
665 (2, 10, -1), # Empty array
666 (10, 3, 1), # Empty array
667 ]
668 for case in cases:
669 result = pa.arange(*case)
670 result.validate(full=True)
671 assert result.equals(pa.array(list(range(*case)), type=pa.int64()))
672
673 # Validate memory_pool keyword argument
674 result = pa.arange(-1, 101, memory_pool=pa.default_memory_pool())
675 result.validate(full=True)
676 assert result.equals(pa.array(list(range(-1, 101)), type=pa.int64()))
677
678 # Special case for invalid step (arange does not accept step of 0)
679 with pytest.raises(pa.ArrowInvalid):
680 pa.arange(0, 10, 0)
681
682
683def test_array_diff():

Callers

nothing calls this directly

Calls 4

listFunction · 0.85
equalsMethod · 0.80
validateMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected