# Commits

committed affc77d

enable and test numpypy.clip

# lib_pypy/numpypy/core/fromnumeric.py

`     array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8])`
` `
`     """`
`-    raise NotImplementedError('Waiting on interp level method')`
`+    if not hasattr(a, 'clip'):`
`+        a = numpypy.array(a)`
`+    return a.clip(a_min, a_max, out=out)`
` `
` `
` def sum(a, axis=None, dtype=None, out=None):`

# pypy/module/test_lib_pypy/numpypy/core/test_fromnumeric.py

`         # a = array([(1, 2), (3, 4)], dtype=[('x', 'i4'), ('y', 'i4')])`
`         # assert shape(a) == (2,)`
` `
`+    def test_clip(self):`
`+        import numpypy as np`
`+        a = np.arange(10)`
`+        b = np.clip(a, 1, 8)`
`+        assert (b == [1, 1, 2, 3, 4, 5, 6, 7, 8, 8]).all()`
`+        assert (a == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]).all()`
`+        b = np.clip(a, 3, 6, out=a)`
`+        assert (b == [3, 3, 3, 3, 4, 5, 6, 6, 6, 6]).all()`
`+        assert (a == [3, 3, 3, 3, 4, 5, 6, 6, 6, 6]).all()`
`+        a = np.arange(10)`
`+        b = np.clip(a, [3,4,1,1,1,4,4,4,4,4], 8)`
`+        assert (b == [3, 4, 2, 3, 4, 5, 6, 7, 8, 8]).all()`
`+        assert (a == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]).all()`
`+`
`     def test_sum(self):`
`         # tests taken from numpy/core/fromnumeric.py docstring`
`         from numpypy import array, sum, ones, zeros`