MCPcopy Create free account
hub / github.com/numpy/numpy / test_kwargs

Function test_kwargs

numpy/lib/tests/test_arraypad.py:1330–1343  ·  view source on GitHub ↗

Test behavior of pad's kwargs for the given mode.

(mode)

Source from the content-addressed store, hash-verified

1328
1329@pytest.mark.parametrize("mode", _all_modes.keys())
1330def test_kwargs(mode):
1331 """Test behavior of pad's kwargs for the given mode."""
1332 allowed = _all_modes[mode]
1333 not_allowed = {}
1334 for kwargs in _all_modes.values():
1335 if kwargs != allowed:
1336 not_allowed.update(kwargs)
1337 # Test if allowed keyword arguments pass
1338 np.pad([1, 2, 3], 1, mode, **allowed)
1339 # Test if prohibited keyword arguments of other modes raise an error
1340 for key, value in not_allowed.items():
1341 match = "unsupported keyword arguments for mode '{}'".format(mode)
1342 with pytest.raises(ValueError, match=match):
1343 np.pad([1, 2, 3], 1, mode, **{key: value})
1344
1345
1346def test_constant_zero_default():

Callers

nothing calls this directly

Calls 2

valuesMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected