(self)
| 261 | npt.assert_array_equal( out, a < np.array([2,2,2]) ) |
| 262 | |
| 263 | def test_casting(self): |
| 264 | logging.info( "Test safe, unsafe, and func helper casting") |
| 265 | |
| 266 | i = np.arange(self.ssize).astype('int32') |
| 267 | # 'Safe' casts |
| 268 | f = ne3.NumExpr('float32(i)')() |
| 269 | # 'Unsafe' casts |
| 270 | b = ne3.NumExpr('int8(i)')() |
| 271 | assert( f.dtype == 'float32' ) |
| 272 | npt.assert_array_equal( i.astype('float32'), f ) |
| 273 | assert( b.dtype == 'int8') |
| 274 | npt.assert_array_equal( i.astype('int8'), b ) |
| 275 | # Helper casts for functions |
| 276 | sin_ne = ne3.NumExpr( 'sin(i)' )() |
| 277 | sin_np = np.sin(i) |
| 278 | assert( sin_np.dtype == sin_ne.dtype ) |
| 279 | npt.assert_array_almost_equal( sin_np, sin_ne ) |
| 280 | |
| 281 | def test_ipow(self): |
| 282 | # Test integer powers; NumPy generates ValueErrors for negative exponents |
nothing calls this directly
no outgoing calls
no test coverage detected