File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 33import warnings
44
55from ._lib import _compat , _utils
6- from ._lib ._compat import (
7- array_namespace ,
8- )
6+ from ._lib ._compat import array_namespace
97from ._lib ._typing import Array , ModuleType
108
119__all__ = [
@@ -561,7 +559,8 @@ def pad(
561559 pad_width : int
562560 Pad the input array with this many elements from each side.
563561 mode : str, optional
564- Only "constant" mode is currently supported.
562+ Only "constant" mode is currently supported, which pads with
563+ the value passed to `constant_values`.
565564 xp : array_namespace, optional
566565 The standard-compatible namespace for `x`. Default: infer.
567566 constant_values : python scalar, optional
@@ -574,7 +573,8 @@ def pad(
574573 padded with ``pad_width`` elements equal to ``constant_values``.
575574 """
576575 if mode != "constant" :
577- raise NotImplementedError ()
576+ msg = "Only `'constant'` mode is currently supported"
577+ raise NotImplementedError (msg )
578578
579579 value = constant_values
580580
Original file line number Diff line number Diff line change @@ -403,3 +403,8 @@ def test_ndim(self):
403403 a = xp .reshape (xp .arange (2 * 3 * 4 ), (2 , 3 , 4 ))
404404 padded = pad (a , 2 )
405405 assert padded .shape == (6 , 7 , 8 )
406+
407+ def test_mode_not_implemented (self ):
408+ a = xp .arange (3 )
409+ with pytest .raises (NotImplementedError , match = "Only `'constant'`" ):
410+ pad (a , 2 , mode = "edge" )
You can’t perform that action at this time.
0 commit comments